No registered users in community xowiki
in last 10 minutes
in last 10 minutes
XOTcl/NX mailing list by object move?
From: <mail_at_xdobry.de>
Date: Wed, 15 Mar 2006 08:57:30 +0100
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
Date: Wed, 15 Mar 2006 08:57:30 +0100
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