discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programming it's a play


From: Pascal J . Bourguignon
Subject: Re: Programming it's a play
Date: Sun, 21 Sep 2003 15:32:02 +0200

Nicolas Roard writes:
> On 2003-09-21 00:00:26 +0000 Pascal J.Bourguignon <address@hidden> wrote> > 
> (I  must admit that  there is  a little  problem in  Objective-C, that
> > there is  no standard API  to the objc  runtime, so doing it  would be
> > compiler dependant).
> 
> Right :-)
> 
> > To see that there is no difference between a class and an object, just try:
> > 
> (snip)
> > address@hidden tests]$ gcc -o objc-class-objc objc-class-objc.m -lobjc 
> > -lpthread
> > address@hidden tests]$ ./objc-class-objc toto
> > name of thing at 0x8058790 is: Object
> > name of thing at 0x8056520 is: Object
> > name of thing at 0x80587d0 is: toto
> > name of thing at 0x8055f40 is: NamedObj
> > 
> > 
> > So, you see  that you can have an class object  or an instance object,
> > and not knowing what it is, send it a message and get work done.
> 
> Ok... I find it a bit strange that this code works... but well ;-)
> 
> > Now,  in Objective-C, there  IS a  difference between  metaclasses and
> > other objects.  In Smalltalk and in Lisp, there is none.
> 
> metaclasses ? you mean Class ?

No, metaclass: the class of a Class object.
Have a look at the files in GNUstep/System/Headers/objc !
or /usr/include/objc.

Since a Class is an object like any other, it needs a class. The class
of a Class  is a metaclass. Since the  class of a class is  a class, a
metaclass is a  class. So a metclass is an object  "like any other" so
it would need  a meta-metaclass.  Only we stop  the expenses here, and
make the metaclass special: it's its own class.

Any introduction to  Smalltalk should explain that better  than me, or
the original Objective-C book:

Object Oriented Programming
Brad J. Cox
Addison Wesley
0201103931

-- 
__Pascal_Bourguignon__
http://www.informatimago.com/
Do not adjust your mind, there is a fault in reality.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]