A more complete solution (preserving any pre-existing superclass lists) is as follows:
package req nx
namespace eval ::vitick {
Class create Object -superclasses nx::Object
Class create Class -superclasses nx::Class { :method init {} { ## ## Rewire the default superclass ## if {[:info superclasses] eq "::nx::Object"} { :configure -superclasses [namespace current]::Object }
} }
namespace export Object Class }
namespace import -force ::vitick::*
puts [[Class create MyClass] info superclasses]; # default is: ::vitick::Object puts [[Class create AnotherClass -superclasses MyClass] info superclasses]; # ::MyClass puts [[Class create AnotherClass -superclasses MyClass] info superclasses -closure]; # ::MyClass ::vitick::Object ::nx::Object
//stefan
Hi Victor,
Any suggestions?
As always, there are several options. One way of nursing our custom Object/Class is to use proper specializations of nx::Object/nx::Class:
package req nx
namespace eval ::vitick {
Class create Object -superclass nx::Object
Class create Class -superclass nx::Class { :method init {} { :configure -superclasses [namespace current]::Object } }
namespace export Object Class }
namespace import -force ::vitick::*
This is less invasive and you have the benefit of monitoring any changes/additions to nx::Object/nx::Class for free.
Cheers, Stefan _______________________________________________ Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl