Re: New Cocoa Programmer
Re: New Cocoa Programmer
- Subject: Re: New Cocoa Programmer
- From: Marcel Weiher <email@hidden>
- Date: Mon, 12 Nov 2001 11:46:48 +0100
On Monday, November 12, 2001, at 10:52 AM, Ondra Cada wrote:
Marcel,
Marcel Weiher (MW) wrote at Mon, 12 Nov 2001 09:26:09 +0100:
MW> Actually, this could be compiled back when class-names by themselves
MW> could be used
MW>
MW> switch ( [myObject class] ) {
MW> case NSString:
MW> break;
MW> }
I'm not that sure:
That's OK. I am positive that factory objects could be referenced
directly, for example in equality tests ( if ( *(Class*)object ==
List ))). I am not 100% certain this would work in switch-statements.
so far as I remember, Brad Cox always made point of that
a class name is always interpreted as a _type_ with the sole exception
of
being a receiver of a message.
Brad Cox and types?? The "class name" refers to the *factory object* of
the class (or alternatively the shared part / shared structure). This
is really just an ordinary object, except that it is typically generated
statically by the compiler.
Marcel