On 20.03.2010, at 09:46, Alex Schenkman wrote: > Hi List! > > I'm playing with class variables. How should I initialize them? > I've tried with the class method initialize but it does not do the job. > > Pirulo class>>initialize > super initialize. > myClassVar := Dictionary new at: 'one' put: 1.
* never call "super initialize" on the class side * class variables should be capitalized * class initializers need to be executed manually * they are only executed automatically when loading the class (e.g. file-in or via Monticello) So this would be right: Pirulo class>>initialize "self initialize" MyClassVar := Dictionary new at: 'one' put: 1. The "self initialize" comment is conventionally put there so you can easily double-click after the opening quotes to select the whole expression, and do-it. You need to do it any time you change the initialize method. This works because when evaluating code in a Browser, "self" refers to the currently selected class. - Bert - _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners