Index: TODO =================================================================== diff -u -r5ebe07f669899129e692d36bcb2016d27ef421b8 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- TODO (.../TODO) (revision 5ebe07f669899129e692d36bcb2016d27ef421b8) +++ TODO (.../TODO) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -1795,7 +1795,12 @@ - make sure not to return CompiledLocal vars from InterpColonVarResolver() when TCL_NAMESPACE_ONLY is requested. +- delegate always from InterpColonVarResolver() to + other resolvers, when TCL_NAMESPACE_ONLY is requested. +- implemented exported command ::nsf::self as fast conveniance + replacement for "::nsf::current object". + TODO: - "-returns" Index: generic/gentclAPI.decls =================================================================== diff -u -rd4c3a709884f94a12e97a2dd95f438caf7863800 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision d4c3a709884f94a12e97a2dd95f438caf7863800) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -140,18 +140,20 @@ nsfCmd current NsfCurrentCmd { {-argName "currentoption" -required 0 -type "proc|method|methodpath|object|class|activelevel|args|activemixin|calledproc|calledmethod|calledclass|callingproc|callingmethod|callingclass|callinglevel|callingobject|filterreg|isnextcall|next"} } - -nsfCmd setvar NsfSetVarCmd { - {-argName "object" -required 1 -type object} - {-argName "varname" -required 1 -type tclobj} - {-argName "value" -required 0 -type tclobj} +nsfCmd self NsfSelfCmd { } nsfCmd setter NsfSetterCmd { {-argName "object" -required 1 -type object} {-argName "-per-object"} {-argName "parameter" -type tclobj} } +nsfCmd setvar NsfSetVarCmd { + {-argName "object" -required 1 -type object} + {-argName "varname" -required 1 -type tclobj} + {-argName "value" -required 0 -type tclobj} +} + # # object methods # Index: generic/nsf.c =================================================================== diff -u -r64810eae2bba5d76d65e49fc5959ffb1c7fc6a8f -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/nsf.c (.../nsf.c) (revision 64810eae2bba5d76d65e49fc5959ffb1c7fc6a8f) +++ generic/nsf.c (.../nsf.c) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -14170,6 +14170,22 @@ } /* +nsfCmd self NsfSelfCmd { +} +*/ +static int +NsfSelfCmd(Tcl_Interp *interp) { + NsfObject *object = GetSelfObj(interp); + + if (object) { + Tcl_SetObjResult(interp, object->cmdName); + return TCL_OK; + } else { + return NsfVarErrMsg(interp, "No current object", (char *) NULL); + } +} + +/* nsfCmd setvar NsfSetVarCmd { {-argName "object" -required 1 -type object} {-argName "varname" -required 1 -type tclobj} Index: generic/nsf.h =================================================================== diff -u -r8651e9f7d6d526196cfe4dad14d08b857a66f5d8 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/nsf.h (.../nsf.h) (revision 8651e9f7d6d526196cfe4dad14d08b857a66f5d8) +++ generic/nsf.h (.../nsf.h) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -77,7 +77,7 @@ /* are we developing? #define NSF_DEVELOPMENT 1 */ -#define NSF_DEVELOPMENT 1 +//#define NSF_DEVELOPMENT 1 /* activate/deacticate assert #define NDEBUG 1 Index: generic/nsf.tcl =================================================================== diff -u -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/nsf.tcl (.../nsf.tcl) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) +++ generic/nsf.tcl (.../nsf.tcl) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -5,7 +5,7 @@ # Symbols reused in the next scripting language - namespace export next current + namespace export next current self # Symbols reused in XOTcl Index: generic/predefined.h =================================================================== diff -u -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/predefined.h (.../predefined.h) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) +++ generic/predefined.h (.../predefined.h) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -1,6 +1,6 @@ static char cmd[] = "namespace eval ::nsf {\n" -"namespace export next current\n" +"namespace export next current self\n" "namespace export alias configure finalize interp is my relation\n" "proc ::nsf::provide_method {require_name definition {script \"\"}} {\n" "set ::nsf::methodIndex($require_name) [list definition $definition script $script]}\n" Index: generic/tclAPI.h =================================================================== diff -u -rd4c3a709884f94a12e97a2dd95f438caf7863800 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- generic/tclAPI.h (.../tclAPI.h) (revision d4c3a709884f94a12e97a2dd95f438caf7863800) +++ generic/tclAPI.h (.../tclAPI.h) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -231,6 +231,7 @@ static int NsfNextCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfQualifyObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfRelationCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfSelfCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfSetVarCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfSetterCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfShowStackCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -314,6 +315,7 @@ static int NsfNextCmd(Tcl_Interp *interp, Tcl_Obj *arguments); static int NsfQualifyObjCmd(Tcl_Interp *interp, Tcl_Obj *objectname); static int NsfRelationCmd(Tcl_Interp *interp, NsfObject *object, int relationtype, Tcl_Obj *value); +static int NsfSelfCmd(Tcl_Interp *interp); static int NsfSetVarCmd(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *varname, Tcl_Obj *value); static int NsfSetterCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *parameter); static int NsfShowStackCmd(Tcl_Interp *interp); @@ -398,6 +400,7 @@ NsfNextCmdIdx, NsfQualifyObjCmdIdx, NsfRelationCmdIdx, + NsfSelfCmdIdx, NsfSetVarCmdIdx, NsfSetterCmdIdx, NsfShowStackCmdIdx, @@ -1357,6 +1360,24 @@ } static int +NsfSelfCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfSelfCmdIdx].paramDefs, + method_definitions[NsfSelfCmdIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + + + ParseContextRelease(&pc); + return NsfSelfCmd(interp); + + } +} + +static int NsfSetVarCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; @@ -2271,6 +2292,9 @@ {"relationtype", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToRelationtype}, {"value", 0, 0, ConvertToTclobj}} }, +{"::nsf::self", NsfSelfCmdStub, 0, { + } +}, {"::nsf::setvar", NsfSetVarCmdStub, 3, { {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"varname", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, Index: library/nx/nx.tcl =================================================================== diff -u -r236c09e4dce9355a63c83b75f8c3a4955148c17d -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- library/nx/nx.tcl (.../nx.tcl) (revision 236c09e4dce9355a63c83b75f8c3a4955148c17d) +++ library/nx/nx.tcl (.../nx.tcl) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -32,7 +32,7 @@ # namespace eval ::nsf {} - namespace import ::nsf::next ::nsf::current + namespace import ::nsf::next ::nsf::current ::nsf::self # # provide the standard command set for ::nx::Object @@ -84,7 +84,7 @@ -verbose:switch path } { - set object [::nsf::current object] + set object [::nsf::self] set methodName $path if {[string first " " $path]} { set methodName [lindex $path end] @@ -183,10 +183,10 @@ # method-modifier for object specific methos :method class-object {what args} { if {$what in [list "alias" "attribute" "forward" "method" "setter"]} { - return [::nsf::dispatch [::nsf::current object] ::nsf::classes::nx::Object::$what {*}$args] + return [::nsf::dispatch [::nsf::self] ::nsf::classes::nx::Object::$what {*}$args] } if {$what in [list "info"]} { - return [::nsf::dispatch [::nsf::current object] ::nx::Object::slot::__info \ + return [::nsf::dispatch [::nsf::self] ::nx::Object::slot::__info \ [lindex $args 0] {*}[lrange $args 1 end]] } if {$what in [list "filter" "mixin"]} { @@ -200,25 +200,25 @@ # the forwarder. # switch [llength $args] { - 0 {return [::nsf::relation [::nsf::current object] object-$what]} - 1 {return [::nsf::relation [::nsf::current object] object-$what {*}$args]} + 0 {return [::nsf::relation [::nsf::self] object-$what]} + 1 {return [::nsf::relation [::nsf::self] object-$what {*}$args]} default {return [::nx::Object::slot::$what [lindex $args 0] \ - [::nsf::current object] object-$what \ + [::nsf::self] object-$what \ {*}[lrange $args 1 end]] } } } if {$what in [list "filterguard" "mixinguard"]} { - return [::nsf::dispatch [::nsf::current object] ::nsf::methods::object::$what {*}$args] + return [::nsf::dispatch [::nsf::self] ::nsf::methods::object::$what {*}$args] } } # define unknown handler for class :method unknown {m args} { - error "Method '$m' unknown for [::nsf::current object].\ - Consider '[::nsf::current object] create $m $args' instead of '[::nsf::current object] $m $args'" + error "Method '$m' unknown for [::nsf::self].\ + Consider '[::nsf::self] create $m $args' instead of '[::nsf::self] $m $args'" } # protected is not yet defined - ::nsf::methodproperty [::nsf::current object] unknown call-protected true + ::nsf::methodproperty [::nsf::self] unknown call-protected true } @@ -229,7 +229,7 @@ set p [lsearch -regexp $args {^(method|alias|attribute|forward|setter)$}] if {$p == -1} {error "$args is not a method defining method"} set r [{*}:$args] - ::nsf::methodproperty [::nsf::current object] $r call-protected false + ::nsf::methodproperty [::nsf::self] $r call-protected false return $r } @@ -238,7 +238,7 @@ set p [lsearch -regexp $args {^(method|alias|attribute|forward|setter)$}] if {$p == -1} {error "$args is not a method defining command"} set r [{*}:$args] - ::nsf::methodproperty [::nsf::current object] $r call-protected true + ::nsf::methodproperty [::nsf::self] $r call-protected true return $r } } @@ -251,14 +251,14 @@ # define it as follows: # # :protected method unknown {m args} { - # error "[::nsf::current object]: unable to dispatch method '$m'" + # error "[::nsf::self]: unable to dispatch method '$m'" # } # "init" must exist on Object. per default it is empty. :protected method init args {} # this method is called on calls to object without a specified method - :protected method defaultmethod {} {::nsf::current object} + :protected method defaultmethod {} {::nsf::self} # provide a placeholder for the bootup process. The real definition # is based on slots, which are not available at this point. @@ -338,14 +338,14 @@ # Add setter methods. # Object public method setter {parameter} { - set o [::nsf::current object] + set o [::nsf::self] set r [::nsf::setter $o -per-object $parameter] ::nsf::methodproperty $o -per-object $r call-protected \ [::nsf::dispatch $o __default_attribute_call_protection] return $r } Class public method setter {parameter} { - set o [::nsf::current object] + set o [::nsf::self] set r [::nsf::setter $o $parameter] ::nsf::methodproperty $o $r call-protected \ [::nsf::dispatch $o __default_attribute_call_protection] @@ -359,14 +359,14 @@ class-object { set what [lindex $args 0] if {$what eq "method"} { - ::nsf::require_method [::nsf::current object] [lindex $args 1] 1 + ::nsf::require_method [::nsf::self] [lindex $args 1] 1 } } method { - ::nsf::require_method [::nsf::current object] [lindex $args 0] 0 + ::nsf::require_method [::nsf::self] [lindex $args 0] 0 } namespace { - ::nsf::dispatch [::nsf::current object] ::nsf::methods::object::requirenamespace + ::nsf::dispatch [::nsf::self] ::nsf::methods::object::requirenamespace } } } @@ -439,7 +439,7 @@ } :protected method defaultmethod {} { - set obj [uplevel {current object}] + set obj [uplevel {self}] set path [current methodpath] set l [string length $path] set submethods [$obj ::nsf::methods::object::info::lookupmethods -path "$path *"] @@ -462,7 +462,7 @@ :alias "info lookup method" ::nsf::methods::object::info::lookupmethod :alias "info lookup methods" ::nsf::methods::object::info::lookupmethods :method "info lookup slots" {} { - ::nsf::dispatch [::nsf::current object] \ + ::nsf::dispatch [::nsf::self] \ ::nsf::methods::object::info::lookupslots -type ::nx::Slot } :alias "info children" ::nsf::methods::object::info::children @@ -480,7 +480,7 @@ :alias "info parent" ::nsf::methods::object::info::parent :alias "info precedence" ::nsf::methods::object::info::precedence :method "info slots" {} { - set slotContainer [::nsf::current object]::slot + set slotContainer [::nsf::self]::slot if {[::nsf::isobject $slotContainer]} { ::nsf::dispatch $slotContainer ::nsf::methods::object::info::children -type ::nx::Slot } @@ -537,7 +537,7 @@ } Object protected method "info unknown" {method obj args} { - error "[::nsf::current object] unknown info option \"$method\"; [$obj info info]" + error "[::nsf::self] unknown info option \"$method\"; [$obj info info]" } Object method "info info" {} {::nx::infoOptions ::nx::Object::slot::__info} @@ -696,11 +696,11 @@ } createBootstrapAttributeSlots ::nx::ObjectParameterSlot { - {name "[namespace tail [::nsf::current object]]"} + {name "[namespace tail [::nsf::self]]"} {methodname} - {domain "[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::nsf::current object]] 1]"} + {domain "[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::nsf::self]] 1]"} {defaultmethods {get assign}} - {manager "[::nsf::current object]"} + {manager "[::nsf::self]"} {per-object false} {nosetter} } @@ -734,12 +734,12 @@ ObjectParameterSlot method unknown {method args} { set methods [list] - foreach m [::nsf::dispatch [::nsf::current object] ::nsf::methods::object::info::lookupmethods] { + foreach m [::nsf::dispatch [::nsf::self] ::nsf::methods::object::info::lookupmethods] { if {[::nsf::dispatch Object ::nsf::methods::object::info::lookupmethods $m] ne ""} continue if {[string match __* $m]} continue lappend methods $m } - error "Method '$method' unknown for slot [::nsf::current object]; valid are: {[lsort $methods]}" + error "Method '$method' unknown for slot [::nsf::self]; valid are: {[lsort $methods]}" } ObjectParameterSlot public method destroy {} { @@ -768,7 +768,7 @@ #puts stderr "Do not register forwarder ${:domain} ${:name}" return } - #puts stderr "Slot [::nsf::current object] init, forwarder on ${:domain}" + #puts stderr "Slot [::nsf::self] init, forwarder on ${:domain}" ::nsf::forward ${:domain} ${:name} \ ${:manager} \ [list %1 [${:manager} defaultmethods]] %self \ @@ -800,11 +800,11 @@ lappend methodopts required } - if {[::nsf::existsvar [::nsf::current object] type] ne [info exists :type]} { - puts stderr "*** VERY STRANGE: info exists :type says [info exists :type], ::nsf::existsvar [::nsf::current object] type says [::nsf::existsvar [::nsf::current object] type]" + if {[::nsf::existsvar [::nsf::self] type] ne [info exists :type]} { + puts stderr "*** VERY STRANGE: info exists :type says [info exists :type], ::nsf::existsvar [::nsf::self] type says [::nsf::existsvar [::nsf::self] type]" } - if {[::nsf::existsvar [::nsf::current object] type]} { + if {[::nsf::existsvar [::nsf::self] type]} { if {[string match ::* ${:type}]} { set type [expr {[::nsf::is metaclass ${:type}] ? "class" : "object"}] lappend objopts type=${:type} @@ -848,7 +848,7 @@ if {${:methodname} ne ${:name}} { lappend objopts arg=${:methodname} lappend methodopts arg=${:methodname} - #puts stderr "..... setting arg for methodname: [::nsf::current object] has arg arg=${:methodname}" + #puts stderr "..... setting arg for methodname: [::nsf::self] has arg arg=${:methodname}" } } if {$type ne ""} { @@ -857,7 +857,7 @@ # provided values, not for defaults. if {$type ne "substdefault"} {set methodopts [linsert $methodopts 0 $type]} } - lappend objopts slot=[::nsf::current object] + lappend objopts slot=[::nsf::self] if {[llength $objopts] > 0} { append objparamdefinition :[join $objopts ,] @@ -888,16 +888,16 @@ } Object protected method objectparameter {{lastparameter __initcmd:initcmd,optional}} { - #puts stderr "... objectparameter [::nsf::current object]" - set parameterdefinitions [::nsf::parametersfromslots [::nsf::current object]] - if {[::nsf::is class [::nsf::current object]]} { + #puts stderr "... objectparameter [::nsf::self]" + set parameterdefinitions [::nsf::parametersfromslots [::nsf::self]] + if {[::nsf::is class [::nsf::self]]} { lappend parameterdefinitions -attributes:method,optional } lappend parameterdefinitions \ -noinit:method,optional,noarg \ -volatile:method,optional,noarg \ {*}$lastparameter - #puts stderr "*** parameter definition for [::nsf::current object]: $parameterdefinitions" + #puts stderr "*** parameter definition for [::nsf::self]: $parameterdefinitions" return $parameterdefinitions } @@ -939,7 +939,7 @@ if {![::nsf::isobject $value]} { error "$value does not appear to be an object" } - set value [::nsf::dispatch $value -frame method ::nsf::current object] + set value [::nsf::dispatch $value -frame method ::nsf::self] } if {![::nsf::is class ${:elementtype}]} { error "$value does not appear to be of type ${:elementtype}" @@ -1069,7 +1069,7 @@ Attribute method __default_from_cmd {obj cmd var sub op} { #puts "GETVAR [::nsf::current method] obj=$obj cmd=$cmd, var=$var, op=$op" ::nsf::dispatch $obj -frame object \ - ::trace remove variable $var $op [list [::nsf::current object] [::nsf::current method] $obj $cmd] + ::trace remove variable $var $op [list [::nsf::self] [::nsf::current method] $obj $cmd] ::nsf::setvar $obj $var [$obj eval $cmd] } Attribute method __value_from_cmd {obj cmd var sub op} { @@ -1085,7 +1085,7 @@ # Do first ordinary slot initialization ::nsf::next set __initcmd "" - set trace {::nsf::dispatch [::nsf::current object] -frame object ::trace} + set trace {::nsf::dispatch [::nsf::self] -frame object ::trace} # There might be already default values registered on the # class. If so, defaultcmd is ignored. if {[info exists :default]} { @@ -1094,33 +1094,33 @@ } elseif [info exists :defaultcmd] { if {[info exists :valuecmd]} {error "valuecmd can't be used together with defaultcmd"} append __initcmd "$trace add variable [list ${:name}] read \ - \[list [::nsf::current object] __default_from_cmd \[::nsf::current object\] [list [set :defaultcmd]]\]\n" + \[list [::nsf::self] __default_from_cmd \[::nsf::self\] [list [set :defaultcmd]]\]\n" } elseif [info exists :valuecmd] { append __initcmd "$trace add variable [list ${:name}] read \ - \[list [::nsf::current object] __value_from_cmd \[::nsf::current object\] [list [set :valuecmd]]\]" + \[list [::nsf::self] __value_from_cmd \[::nsf::self\] [list [set :valuecmd]]\]" } if {[info exists :valuechangedcmd]} { append __initcmd "$trace add variable [list ${:name}] write \ - \[list [::nsf::current object] __value_changed_cmd \[::nsf::current object\] [list [set :valuechangedcmd]]\]" + \[list [::nsf::self] __value_changed_cmd \[::nsf::self\] [list [set :valuechangedcmd]]\]" } array set "" [:toParameterSyntax ${:name}] - #puts stderr "Attribute.init valueParam for [::nsf::current object] is $(mparam)" + #puts stderr "Attribute.init valueParam for [::nsf::self] is $(mparam)" if {$(mparam) ne ""} { if {[info exists :multivalued] && ${:multivalued}} { # set variable "body" to minimize problems with spacing, since # the body is literally compared by the slot optimizer. set body {::nsf::setvar $obj $var $value} - :public method assign [list obj var value:$(mparam),multivalued,slot=[::nsf::current object]] \ + :public method assign [list obj var value:$(mparam),multivalued,slot=[::nsf::self]] \ $body - #puts stderr "adding add method for [::nsf::current object] with value:$(mparam)" - :public method add [list obj prop value:$(mparam),slot=[::nsf::current object] {pos 0}] { + #puts stderr "adding add method for [::nsf::self] with value:$(mparam)" + :public method add [list obj prop value:$(mparam),slot=[::nsf::self] {pos 0}] { ::nsf::next } } else { set body {::nsf::setvar $obj $var $value} - :public method assign [list obj var value:$(mparam),slot=[::nsf::current object]] $body + :public method assign [list obj var value:$(mparam),slot=[::nsf::self]] $body } } if {$__initcmd ne ""} { @@ -1192,16 +1192,16 @@ # Define method "attribute" for convenience ############################################ Class method attribute {spec {-slotclass ::nx::Attribute} {initblock ""}} { - set r [$slotclass createFromParameterSyntax [::nsf::current object] -initblock $initblock {*}$spec] - set o [::nsf::current object] + set r [$slotclass createFromParameterSyntax [::nsf::self] -initblock $initblock {*}$spec] + set o [::nsf::self] ::nsf::methodproperty $o $r call-protected \ [::nsf::dispatch $o __default_attribute_call_protection] return $r } Object method attribute {spec {-slotclass ::nx::Attribute} {initblock ""}} { - set r [$slotclass createFromParameterSyntax [::nsf::current object] -per-object -initblock $initblock {*}$spec] - set o [::nsf::current object] + set r [$slotclass createFromParameterSyntax [::nsf::self] -per-object -initblock $initblock {*}$spec] + set o [::nsf::self] ::nsf::methodproperty $o -per-object $r call-protected \ [::nsf::dispatch $o __default_attribute_call_protection] return $r @@ -1214,14 +1214,14 @@ Class public method attributes arglist { foreach arg $arglist { - Attribute createFromParameterSyntax [::nsf::current object] {*}$arg + Attribute createFromParameterSyntax [::nsf::self] {*}$arg } - set slot [::nx::slotObj [::nsf::current object]] + set slot [::nx::slotObj [::nsf::self]] ::nsf::setvar $slot __parameter $arglist } Class method "info attributes" {} { - set slot [::nx::slotObj [::nsf::current object]] + set slot [::nx::slotObj [::nsf::self]] if {[::nsf::existsvar $slot __parameter]} { return [::nsf::setvar $slot __parameter] } @@ -1272,7 +1272,7 @@ {-class:class ::nx::Object} cmds } { - if {![info exists object]} {set object [::nsf::current object]} + if {![info exists object]} {set object [::nsf::self]} if {![::nsf::isobject $object]} {$class create $object} # reused in XOTcl, no "require" there, so use nsf primitiva ::nsf::dispatch $object ::nsf::methods::object::requirenamespace @@ -1294,7 +1294,7 @@ # TODO: This is the slots method.... remove it for now. # #Class forward slots %self contains \ - # -object {%::nsf::dispatch [::nsf::current object] -objscope ::subst [::nsf::current object]::slot} + # -object {%::nsf::dispatch [::nsf::self] -objscope ::subst [::nsf::self]::slot} ################################################################## # copy/move implementation @@ -1420,7 +1420,7 @@ } :public method copy {obj dest} { - #puts stderr "[::nsf::current object] copy <$obj> <$dest>" + #puts stderr "[::nsf::self] copy <$obj> <$dest>" set :objLength [string length $obj] set :dest $dest :makeTargetList $obj @@ -1430,21 +1430,21 @@ } Object public method copy newName { - if {[string compare [string trimleft $newName :] [string trimleft [::nsf::current object] :]]} { - [CopyHandler new -volatile] copy [::nsf::current object] $newName + if {[string compare [string trimleft $newName :] [string trimleft [::nsf::self] :]]} { + [CopyHandler new -volatile] copy [::nsf::self] $newName } } Object public method move newName { - if {[string trimleft $newName :] ne [string trimleft [::nsf::current object] :]} { + if {[string trimleft $newName :] ne [string trimleft [::nsf::self] :]} { if {$newName ne ""} { :copy $newName } ### let all subclasses get the copied class as superclass - if {[::nsf::is class [::nsf::current object]] && $newName ne ""} { + if {[::nsf::is class [::nsf::self]] && $newName ne ""} { foreach subclass [:info subclass] { set scl [$subclass info superclass] - if {[set index [lsearch -exact $scl [::nsf::current object]]] != -1} { + if {[set index [lsearch -exact $scl [::nsf::self]]] != -1} { set scl [lreplace $scl $index $index $newName] $subclass superclass $scl } @@ -1485,7 +1485,7 @@ ::nsf::method Object __default_method_call_protection args [list return $value] ::nsf::methodproperty Object __default_method_call_protection call-protected true } - return [::nsf::dispatch [::nx::current object] __default_method_call_protection] + return [::nsf::dispatch [::nx::self] __default_method_call_protection] } # @@ -1498,7 +1498,7 @@ ::nsf::method Object __default_attribute_call_protection args [list return $value] ::nsf::methodproperty Object __default_attribute_call_protection call-protected true } - return [::nsf::dispatch [::nx::current object] __default_attribute_call_protection] + return [::nsf::dispatch [::nx::self] __default_attribute_call_protection] } } # @@ -1518,7 +1518,7 @@ :public alias set ::nsf::setvar } - interp alias {} ::nx::self {} ::nsf::current object + #interp alias {} ::nx::self {} ::nsf::self set value "?add class?|?classes?|?delete class?" set ::nsf::parametersyntax(::nsf::classes::nx::Object::mixin) $value @@ -1531,7 +1531,7 @@ set ::nsf::parametersyntax(::nsf::classes::nx::Object::eval) "arg ?arg ...?" unset value - ::nsf::configure debug 1 + ::nsf::configure debug 0 } ####################################################################### Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r0c03b745902c592c2ea8d637cc7f6b85fbf7c895 -r6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 0c03b745902c592c2ea8d637cc7f6b85fbf7c895) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 6c2e8f94be1ba335ff90d4b6b5132c98a9f5c242) @@ -52,13 +52,14 @@ #interp alias {} ::xotcl::Attribute {} ::nx::Attribute ::nx::Class create ::xotcl::Attribute -superclass ::nx::Attribute - proc ::xotcl::self {{arg "object"}} { + proc ::xotcl::self {{arg ""}} { switch $arg { - next { - set handle [uplevel ::nsf::current $arg] - method_handle_to_xotcl $handle - } - default {uplevel ::nsf::current $arg} + "" {uplevel ::nsf::self} + next { + set handle [uplevel ::nsf::current $arg] + method_handle_to_xotcl $handle + } + default {uplevel ::nsf::current $arg} } }