• 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: WTF? How can this work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WTF? How can this work?


  • Subject: Re: WTF? How can this work?
  • From: John Hörnkvist <email@hidden>
  • Date: Sun, 19 Aug 2001 12:34:11 +0200

On Sunday, August 19, 2001, at 05:30 AM, Mike Beam wrote:


Now of course when I compile this I get the warning that NSArray doesn't
respond to addObject:, but when I run the app, enter some text into the
textfield and hit enter, thereby invoking add:, in the console appears my
text as an array description. Repeating this adds newly typed text into the
array and displays in the PB console the description of the array, with the
newly added elements.

Again, maybe I'm *completely* missing something fundamental here, but I
though NSArrays were _immutable_. It seems like this one here is behaving
exactly like an NSMutableArray. Is this behavior correct? Did the compiler
notice me trying to send addObject to an NSArray and decide that I really
wanted array to be typed NSMutableArray? Any help would be appreciated.

We had a long discussion on this on email@hidden; search the list archives on "NEWBIE : class names ?" and "The mutable-immutable issue".

In essence, the problem is that Apple has chosen to implement NSArray and NSMutableArray with the same class. I regard this as a bug.

Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


  • Follow-Ups:
    • Re: WTF? How can this work?
      • From: Ondra Cada <email@hidden>
References: 
 >WTF? How can this work? (From: Mike Beam <email@hidden>)

  • Prev by Date: Re: Talking to a serial port
  • Next by Date: Re: Redeclaring overrides
  • Previous by thread: Re: WTF? How can this work?
  • Next by thread: Re: WTF? How can this work?
  • Index(es):
    • Date
    • Thread