AW: [Xotcl] destroy invoked by object move?

Kristoffer Lawson setok at fishpool.com
Mon Mar 20 20:29:57 CET 2006


On 20 Mar 2006, at 18:13, Koen Danckaert wrote:

>>>> I have added "::xotcl::mymethod" and "::xotcl::myvar" to my
>>>> development version. i guess, you would you prefer to have
>>>> these exported. Opinions?
>>>
>>> On giving it some thought I think I actually prefer the version  
>>> that  would be part of Object. After all, it is that object's  
>>> variable that  we want.
>
> Well, in any case we're not adding new functionality here, we're  
> just adding convenience procedures to write callbacks in a more  
> concise and readable way. I believe this is best achieved by having  
> 2 short and concise keywords. In my code, "myproc foo" (vs "my  
> foo") indicates clearly that I'm not actually calling foo, just  
> referring to it. This distinction would be less clear with "my  
> callback foo".

I still think the original proposal does not actually describe what  
is going on. "My proc? What my proc? This is a proc, what's the  
matter with it?". Besides, splitting the functionality into a method  
means we can use it on other objects than our[selves].

This is more than just shorthand. It's also about hiding the details  
of method and variable implementation. It just feels cleaner to get a  
real variable reference through some procedural call, instead of  
building it up yourself based on namespace assumptions.

> So indeed, if these keywords would be predefined in xotcl, I would  
> prefer to have them exported, otherwise they'd not be short and  
> concise either :-)

Yes, if the solution ends up being based on top-level commands, then  
exporting them sounds reasonable.

>>> I don't use it that frequently so I don't mind writing a bit   
>>> extra, for clarity's sake.
>
> I use it quite often. It's a very common construct in Tk and event- 
> based scripts, I think. I've even customized my editor to highlight  
> "myproc" and "myvar", such that they spring out immediately.

It's only really necessary for variables which are linked to other  
systems as for callbacks you can generally do f.ex.:

after 100 [list [self] doStuff]

which is what I actually do. I mean, presumably the problem with  
using a method by its direct namespace is also that filters get  
avoided, or? (at least I think it was that way at some point in  
XOTcl's history). That, to me, would mean it's not a good method  
except for very specific cases.

            /  http://www.fishpool.com/~setok/



More information about the Xotcl mailing list