• 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 calling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function calling


  • Subject: Re: Function calling
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 25 May 2005 19:53:32 -0700

On May 25, 2005, at 6:54 PM, Thomas Davie wrote:
With a sufficiently intelligent type system, like Haskell's, you will have a type that describes a "list of objects that implement intValue", which can be verified at compile time.

But unless the type system itself is Turing-complete, it may not be able to express the complete set of features you can get via runtime polymorphism.


For example, in Cocoa and Objective-C you can work very easily and naturally with heterogeneous collections (and you do so any time you use a plist). Many other languages insist on not just statically typing the collection itself but also statically typing its contents. (Either that or they conflate the collection with its contents and the means of accessing them, as STL tends to with iterators and multiple ordered-collection classes without a common base class.)

Ultimately, in Objective-C and Cocoa you can write code that takes an arbitrary object that responds to objectEnumerator, treats the result of sending it -objectEnumerator as an enumerator, performs one operation on every other dictionary element and a separate operation on every array element that's also been mentioned in one of the previous dictionary elements, and ignores any other objects in the collection. (I could see writing code along these lines in a complex simulation.) Representing the type of that original arbitrary object in a static type system would be more than a little bit of a challenge, as would validating that a particular parameter conforms to that type.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Function calling (From: "Theodore H. Smith" <email@hidden>)
 >Re: Function calling (From: Ondra Cada <email@hidden>)
 >Re: Function calling (From: Thomas Davie <email@hidden>)
 >Re: Function calling (From: Bob Ippolito <email@hidden>)
 >Re: Function calling (From: Thomas Davie <email@hidden>)
 >Re: Function calling (From: Ondra Cada <email@hidden>)
 >Re: Function calling (From: Bob Ippolito <email@hidden>)
 >Re: Function calling (From: Ondra Cada <email@hidden>)
 >Re: Function calling (From: Thomas Davie <email@hidden>)

  • Prev by Date: [Moderator] Re: Function calling
  • Next by Date: Re: Getting the default responder in the chain
  • Previous by thread: Re: Function calling
  • Next by thread: Re: Function calling
  • Index(es):
    • Date
    • Thread