AW: [Xotcl] destroy invoked by object move?

Kristoffer Lawson setok at fishpool.com
Wed Mar 15 12:23:28 CET 2006


On 15 Mar 2006, at 12:17, Gustaf Neumann wrote:
>
> The implementation of move as copy+destroy is a compromise between
> simplicity and functionality. I can imagine cases, where one wants
> to have more or less the equivalent to a copy constructor when
> copy occurs and maybe something different when a move happens.
> However, since all methods are equal in xotcl, it is quite simple
> for a poweruser of xotcl to overload copy/move and add applicaton
> specific addtional behavior to it. if one does not like the side- 
> effects
> of destroy in a move, a custom move operation can set in instance
> variable "__during_move__" and query this from the destroy
> method to change its behavior.

I am actually quite surprised to find that the move operation calls  
the destructor. This is not mentioned on the reference manual and  
does, in fact, seem counter-intuitive. A move is a move, nothing is  
being destroyed, so why call the destructor? I understand that the  
operation is actually quite expensive, due to current Tcl internals,  
but is there any reason why a destructor should be called? If we want  
a method called for a move operation, surely it would be simple to  
define that a "beingMoved" method is then called.

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



More information about the Xotcl mailing list