Hello

sourcery squeak-dev.sourcery at forum-mail.net
Sun May 18 09:27:10 UTC 2003


On Sat, 17 May 2003 18:49:47 -0700, sourcery <squeak-dev.sourcery at forum- 
mail.net> wrote:


> You can write code that generates the accessor and generator methods.

Should be: '...accessor and **mutator** methods...'.

>
> An example of the necessary code:
>
> | names |
> names := MyClass instVarNames.
> 1 to: names size do: [:index |
> 	| name capitalizedName |
> 	name := localNames at: index.
> 	capitalizedName := name withFirstCharCapitalized.
> 	MyClass 		compile: 'set', capitalizedName, ': a', capitalizedName, '
> 				', name, ' := a', capitalizedName
> 		classified: #accessing]

'localNames' => 'names'

The #instVarNames message answers the names of the instance variables
locally defined by the class.  There is also the message #allInstVarNames,
that answers the full set of instance variable names (i.e., including
the ones inherited from superclasses.)

Hopefully, I remembered to take my Freudian Slippers off before posting,
this time around :-)

-- 
The Stupid Party thinks everyone else is evil.  The Evil Party thinks 
everyone else is stupid.



More information about the Squeak-dev mailing list