Alexander Burger wrote:
> Hello Cle,

Hello Alex,

(...)

> In terms of "beauty", there are not many options, though. I would
> use:
>
> (put '+aClass 'ClassVar "new value")
>
> and perhaps write a utility function.

thanks for the hint. Is there any special reason, why there is no such
utility function in picoLisp for that task? I mean defining and querying
helpers exists ... :-/

(...)

> Yes, it depends on 'This' being bound.

Ah ok, then I understood, I think :-)

> 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.

I now, therefore I had hoped for a class variable setter, that would
allow to update a class variable in the first class where it was found.
Right so as the querying function (var:).

Do you have any proposal, what such a helper/utility function should be
called to fit into (var:) (var) functions that already exists?

>> 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 class.

Yep, like in Ruby or Smalltalk for instance ;-) I really need a counter,
that is member of the class, as instance creation will increment said
counter.

>> (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.

Hmmm ... if I do not write an utility function, I will switch to 'put'
here. And yes, in this case I want to capture the current class.
However, if I fiddle out, what such an utility function should look
like, I will probably use that function then, instead of capturing the
current class ...

> Cheers, - Alex

Ciao,
cle.

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

Reply via email to