AW: [Xotcl] destroy invoked by object move?

mail at xdobry.de mail at xdobry.de
Wed Mar 15 08:57:30 CET 2006


Hi Scott!

Indeed move in XOTcl is copy+destroy and it is implemented in XOTcl itself.

%Object info instbody move
if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {
if {$newName != ""} {
::xotcl::my copy $newName}
if {[::xotcl::my isclass [::xotcl::self]] && $newName != ""} {
foreach subclass [::xotcl::my info subclass] {
set scl [$subclass info superclass]
if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} {
set scl [lreplace $scl $index $index $newName]
$subclass superclass $scl}}	}
::xotcl::my destroy}

So move it not rename references.
Is it anyway good idea to rename references?
So reference (object name) is its identity (what about dangling pointers).

So time ago I wanted to program (movable) tree structures by using nested objects.
Operation of moving tree items I have implented as move operation.
After I have discovered, what indeed move is, I have changed the implementation.
I think it is a little trap in XOTcl, because many user thinks it is magic fast and do not really destory objects. Indeed it is quite expensive.

Artur


More information about the Xotcl mailing list