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

Re: Mutability


  • Subject: Re: Mutability
  • From: John Hörnkvist <email@hidden>
  • Date: Wed, 21 Nov 2001 21:19:37 +0100

On Wednesday, November 21, 2001, at 08:34 , John C. Randolph wrote:

Since I implemented this category of NSObject, everything in my code is capable of behaving as a collection of a single object. Now, suppose I have code that expects its parameter to be an NSArray, and I pass it a single object instead. I contend that if the method in question demands that its parameter must *be* an array, instead of demanding that it can *act as* an array, then it's being needlessly particular.

This is well known among type theorists; the type system you're after is called "Matching". Read 'Subtyping is not a good "Match" for object-oriented languages' by Kim B. Bruce, Leaf Petersen, Adrian Fiech or 'On subtyping and matching' by Martin Abadi and Luca Cardelli.

Subtyping and inheritance are convenient ways to describe what an object can do, but not a good way to specify requirements.
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


References: 
 >Re: Mutability (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: RE: local ip address?
  • Next by Date: Re: What's up with sinf()?
  • Previous by thread: Re: Mutability
  • Next by thread: Re: Mutability
  • Index(es):
    • Date
    • Thread