• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Function overloading for ObjC classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function overloading for ObjC classes


  • Subject: Re: Function overloading for ObjC classes
  • From: Allan Odgaard <email@hidden>
  • Date: Sun, 22 Feb 2004 19:25:03 +0100

On 22. Feb 2004, at 11:53, Ondra Cada wrote:

Uh-oh. There are three things:
[...]
None of the three has anything to do with overloading.

So what are you saying? that none of the three introduce a static type for use in overloading? as stated, it does work if only I use @class -- it also works for types which are not as closely related, i.e. I can make an NSString overload and an NSData overload.

That's The Good Thing, incidentally, for overloading is bad

That might be your opinion -- but if it is supposed to work, it really ought to work, despite the obvious ways in which it can be misused.

(since it is based on the compile-time type information, and thus could and would bring ugly inconsistencies at runtime

To avoid run-time errors with Cocoa you would have to fill your code with isKindOf: assertions, even without function overloading.

In C++ or Java the overloading is just a poor man's replacement for categories (and in C++ also lack of instanceof, although that is to be used only in emergencies ;)

C++ has both typeid, dynamic_cast and RTTI (run-time type information) -- but function overloading does serve many useful purposes -- mostly related to generic programming, something absent from Cocoa, despite its OO features ;)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Function overloading for ObjC classes
      • From: Chris Hanson <email@hidden>
    • Re: Function overloading for ObjC classes
      • From: Charles Srstka <email@hidden>
References: 
 >Re: Function overloading for ObjC classes (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: NSTableView
  • Next by Date: Re: Function overloading for ObjC classes
  • Previous by thread: Re: Function overloading for ObjC classes
  • Next by thread: Re: Function overloading for ObjC classes
  • Index(es):
    • Date
    • Thread