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

Re: NSDictionary mutability test


  • Subject: Re: NSDictionary mutability test
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 8 Dec 2008 15:20:25 -0500

On Dec 8, 2008, at 2:53 PM, email@hidden wrote:

On 8 Dec 2008, at 18:53, Sherm Pendley wrote:

No, the solution is to not try to test for mutability. Such tests don't work because they're not *supposed* to work - code that tries to do such things is broken as designed. And no, it's not an "ethical" issue. Writing broken code isn't a question of good and evil, it's simply a question of what works and doesn't work.

I would disagree. I see nothing wrong with the logically necessity of testing for mutability. It's just a property.

As Savant said, if it's an object you created, you should already know whether it's mutable or not, because you created it with whichever property you need.


If it's not an object you created, then it was passed to you via an API. An API is like a contract, in that its requirements work both ways. It's not just describing the behavior of other code, but the expectations it has of your code as well.

If the API specifies an immutable collection, it's not just telling you that code other than yours won't be modifying it - it's also telling you that some other code is not expecting *you* to do so either, and may react badly if you do.

sherm--

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSDictionary mutability test (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary mutability test (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary mutability test (From: Sherm Pendley <email@hidden>)
 >Re: NSDictionary mutability test (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: NSDictionary mutability test
  • Next by Date: Re: NSDictionary mutability test
  • Previous by thread: Re: NSDictionary mutability test
  • Next by thread: Re: NSDictionary mutability test
  • Index(es):
    • Date
    • Thread