On May 26, 2007, at 18:32 , mstram wrote:


Well obviously I need to a lot more reading and experimenting with this, even if "class" methods are "regular" methods, there is something different
with them as far as :

1) the syntax to access them ("fire" .. "call" .. "invoke" ??? what is the
traditional term ? )


There is no special syntax. The only difference is the receiver. Either you send a message to an instance of a class or or the class itself (which, as mentioned before, is a regular object).

2) At least one difference I've found is that I when tried to create a
"class" method that accessed an instance variable,

Instance variables are private, they can only be accessed by the object itself. So from the class object you cannot access instance variables of one of its instances.

Squeak warned that the variable didn't exist and asked if I wante to create it (is this a bug?) ...
even though it was "declared" in the class definition.
[...]
But Squeak says that 'ivar1' is undeclared and asks if I want to declare it. It accepts it being declared as an instance variable (even though it already
was according to the class definition ... (is this a bug?).

No, what you did there is you defined 'ivar1' as an instance variable of the class object itself, not for instances of your class. It will be listed in the browser when you switch to the class side definition. This feature is very rarely used.

- Bert -


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to