Hi Cle,

> > (dm foos> () (mapcar cdr (val (: Foos))) )
> Howevery only if the receiver is the class. If I use an instance as
> receiver, it would not work! I would like to code the method the way,
> that the method will work regardless if the receiver is a class or one
> of its instances; like it works in Smalltalk, C++, Java, Ruby ...

This is rather straightforward:

   (dm foos> ()
      (mapcar cdr (val (or (: Foos) (var: Foos)))) )

Then we can try

: (foos> '+Foo)                           # Send message to class
-> ($385464611 $385464635 $385464656)
: (foos> '$385464611)                     # Send message to object
-> ($385464611 $385464635 $385464656)

With this solution we still avoid hard-coding the class into the method,
which would give problems, for example, if the 'foos>' method were
inherited by a subclass.

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to