• 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: Ondra Cada <email@hidden>
  • Date: Wed, 21 Nov 2001 14:57:35 +0100

Drew,

>>>>>> Drew McCormack (DMC) wrote at Wed, 21 Nov 2001 09:19:42 +0100:
DMC> Exactly. Using immutable classes would effectively be saying "You are
DMC> not supposed to change these arrays/dictionaries", so you have to ask
DMC> "Why are you changing them to begin with?".

Well, I do agree that

NSArray *changeIfNeeded(NSArray *array);

would not look quite right. There is a number of cases when

NSArray *chageIfNeeded(id array)

comes to mind though, and should be supported properly. In OpenStep it was.
In OS X it is not (since I can't determine whether array is mutable or not).

Don't please forget, incidentally, that "Class*" types are relatively new
thing in ObjC and in a sense they go against its object oriented foundation.
The original ObjC which knew id only (just like SmallTalk) was much cleaner
from the OO point of view.

So far as I understand OOP, the proper OO point of view is "give _any_
object to me; I'll determine what kind it is, and I'll behave accordingly".

Those "Class*" things in newer ObjC are just hints for compiler to be able
to solve some situations with non-OO data properly, and perhaps to warn us
when we made a mistake; it should *NOT* mess up with the runtime object
system though, or we are bound to go the C++ way to hell!

DMC> Really, using things like "isKindOfClass" is often a symptom of bad
DMC> design.

Is it?!? I'd say it is a symptom of _THE PROPER_, ie. run-time design, as
compared with the bad, C++-like compile-time one!
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


  • Follow-Ups:
    • Re: Mutability
      • From: Drew McCormack <email@hidden>
    • Re: Mutability
      • From: Julien Dufour <email@hidden>
References: 
 >Re: Mutability (From: Drew McCormack <email@hidden>)

  • Prev by Date: CD format
  • Next by Date: Re: Mutability
  • Previous by thread: Re: Mutability
  • Next by thread: Re: Mutability
  • Index(es):
    • Date
    • Thread