> Now I have detected the class variables I want to use now. But the
> question raise, how to update a class variable?
> But for update, I only came up with this ugly code:
> (with '+aClass
> (=: ClassVar "new value"))
'with' is - in terms of processing - indeed a little overkill, as it
does an extra binding of 'This'.
In terms of "beauty", there are not many options, though. I would use:
(put '+aClass 'ClassVar "new value")
and perhaps write a utility function.
> And another question in that context: how can I get the class of an
> instance usable for (with)? If I try
> (with This ...)
> I have to send the method to the class directly and not via an instance.
> However if I try
> (with (car (type This)) ...)
> I can use this only within a method send to an instance, but not if send
> to the class directly!
Yes, it depends on 'This' being bound.
BTW: There is no such thing as "the class" of an instance. There is
always a list of classes. (car (type This)) might not be the right
class, the "main" class is usually (last (type This)) while the other
classes in the list are usually "prefix" classes.
> The only way I found working reliable (use class regardless if in a
> method send to a class or an instance) seem to be
Note that in picoLisp there is no formal difference between objects and
classes. Objects may have local method definitions, and classes have
instance variables. So it just depends on the context, and on what the
programmer has in mind, if a symbol is regarded as an object or as a
> (with '`*Class ...)
> Is this the correct way, or did I overlook something?
I'm not sure I completely understood what you want to achieve. This is
correct, if you want to capture the current class. Again, you could also
simply use 'put' here.