Index: generic/predefined.h =================================================================== diff -u -r1f1067f1a36bee1c928bb28c5284f53bf422c6dd -rd16b1ff12a9ab1dd196bbdb33510ad94959155b3 --- generic/predefined.h (.../predefined.h) (revision 1f1067f1a36bee1c928bb28c5284f53bf422c6dd) +++ generic/predefined.h (.../predefined.h) (revision d16b1ff12a9ab1dd196bbdb33510ad94959155b3) @@ -25,79 +25,79 @@ "set conditions [list]\n" "if {[info exists precondition]} {lappend conditions -precondition $precondition}\n" "if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" -"::xotcl::method [self] $name $arguments $body {*}$conditions}\n" +"::xotcl::method [::xotcl::current object] $name $arguments $body {*}$conditions}\n" "::xotcl::method Object method {\n" "name arguments body -precondition -postcondition} {\n" "set conditions [list]\n" "if {[info exists precondition]} {lappend conditions -precondition $precondition}\n" "if {[info exists postcondition]} {lappend conditions -postcondition $postcondition}\n" -"::xotcl::method [self] -per-object $name $arguments $body {*}$conditions}\n" +"::xotcl::method [::xotcl::current object] -per-object $name $arguments $body {*}$conditions}\n" "Class eval {\n" ":method object {what args} {\n" "if {$what in [list \"alias\" \"attribute\" \"forward\" \"method\" \"setter\"]} {\n" -"return [::xotcl::dispatch [self] ::xotcl::classes::xotcl2::Object::$what {*}$args]}\n" +"return [::xotcl::dispatch [::xotcl::current object] ::xotcl::classes::xotcl2::Object::$what {*}$args]}\n" "if {$what in [list \"info\"]} {\n" -"return [::xotcl2::objectInfo [lindex $args 0] [self] {*}[lrange $args 1 end]]}\n" +"return [::xotcl2::objectInfo [lindex $args 0] [::xotcl::current object] {*}[lrange $args 1 end]]}\n" "if {$what in [list \"filter\" \"mixin\"]} {\n" "return [:object-$what {*}$args]}\n" "if {$what in [list \"filterguard\" \"mixinguard\"]} {\n" -"return [::xotcl::dispatch [self] ::xotcl::cmd::Object::$what {*}$args]}}\n" +"return [::xotcl::dispatch [::xotcl::current object] ::xotcl::cmd::Object::$what {*}$args]}}\n" ":method unknown {m args} {\n" -"error \"Method '$m' unknown for [self].\\\n" -"Consider '[self] create $m $args' instead of '[self] $m $args'\"}\n" -"::xotcl::methodproperty [self] unknown protected 1}\n" +"error \"Method '$m' unknown for [::xotcl::current object].\\\n" +"Consider '[::xotcl::current object] create $m $args' instead of '[::xotcl::current object] $m $args'\"}\n" +"::xotcl::methodproperty [::xotcl::current object] unknown protected 1}\n" "Object eval {\n" ":method public {args} {\n" "set p [lsearch -regexp $args {^(method|alias|attribute|forward|setter)$}]\n" "if {$p == -1} {error \"$args is not a method defining method\"}\n" "set r [{*}:$args]\n" -"::xotcl::methodproperty [self] $r protected false\n" +"::xotcl::methodproperty [::xotcl::current object] $r protected false\n" "return $r}\n" ":method protected {args} {\n" "set p [lsearch -regexp $args {^(method|alias|attribute|forward|setter)$}]\n" "if {$p == -1} {error \"$args is not a method defining command\"}\n" "set r [{*}:$args]\n" -"::xotcl::methodproperty [self] $r [self proc] true\n" +"::xotcl::methodproperty [::xotcl::current object] $r [::xotcl::current method] true\n" "return $r}\n" ":protected method unknown {m args} {\n" -"if {![self isnext]} {\n" -"error \"[self]: unable to dispatch method '$m'\"}}\n" +"if {![::xotcl::current isnext]} {\n" +"error \"[::xotcl::current object]: unable to dispatch method '$m'\"}}\n" ":protected method init args {}\n" -":protected method defaultmethod {} {::xotcl::self}\n" +":protected method defaultmethod {} {::xotcl::current object}\n" ":protected method objectparameter {} {;}}\n" "::xotcl::forward Object forward ::xotcl::forward %self -per-object\n" "::xotcl::forward Class forward ::xotcl::forward %self\n" "Class protected object method __unknown {name} {}\n" "Object public method alias {-nonleaf:switch -objscope:switch methodName cmd} {\n" -"::xotcl::alias [self] -per-object $methodName \\\n" +"::xotcl::alias [::xotcl::current object] -per-object $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" "{*}[expr {${nonleaf} ? \"-nonleaf\" : \"\"}] \\\n" "$cmd}\n" "Class public method alias {-nonleaf:switch -objscope:switch methodName cmd} {\n" -"::xotcl::alias [self] $methodName \\\n" +"::xotcl::alias [::xotcl::current object] $methodName \\\n" "{*}[expr {${objscope} ? \"-objscope\" : \"\"}] \\\n" "{*}[expr {${nonleaf} ? \"-nonleaf\" : \"\"}] \\\n" "$cmd}\n" "Object public method setter {methodName value:optional} {\n" "if {[info exists value]} {\n" -"::xotcl::setter [self] -per-object $methodName $value} else {\n" -"::xotcl::setter [self] -per-object $methodName}}\n" +"::xotcl::setter [::xotcl::current object] -per-object $methodName $value} else {\n" +"::xotcl::setter [::xotcl::current object] -per-object $methodName}}\n" "Class public method setter {methodName value:optional} {\n" "if {[info exists value]} {\n" -"::xotcl::setter [self] $methodName $value} else {\n" -"::xotcl::setter [self] $methodName}}\n" +"::xotcl::setter [::xotcl::current object] $methodName $value} else {\n" +"::xotcl::setter [::xotcl::current object] $methodName}}\n" "Object create ::xotcl2::objectInfo\n" "Object create ::xotcl2::classInfo\n" "objectInfo eval {\n" ":alias is ::xotcl::objectproperty\n" ":public method info {obj} {\n" "set methods [list]\n" -"foreach name [::xotcl::cmd::ObjectInfo::methods [self]] {\n" +"foreach name [::xotcl::cmd::ObjectInfo::methods [::xotcl::current object]] {\n" "if {$name eq \"unknown\"} continue\n" "lappend methods $name}\n" "return \"valid options are: [join [lsort $methods] {, }]\"}\n" ":method unknown {method obj args} {\n" -"error \"[::xotcl::self] unknown info option \\\"$method\\\"; [$obj info info]\"}}\n" +"error \"[::xotcl::current object] unknown info option \\\"$method\\\"; [$obj info info]\"}}\n" "classInfo eval {\n" ":alias is ::xotcl::objectproperty\n" ":alias classparent ::xotcl::cmd::ObjectInfo::parent\n" @@ -123,7 +123,7 @@ "if {$methtype ne \"method\"} {\n" "error \"invalid method type '$methtype', must be 'method'\"}\n" "set body \"\n" -"if {!\\[::xotcl::self isnextcall\\]} {\n" +"if {!\\[::xotcl::current isnextcall\\]} {\n" "error \\\"Abstract method $methname $arglist called\\\"} else {::xotcl::next}\n" "\"\n" "if {${per-object}} {\n" @@ -202,11 +202,11 @@ "default\n" "type}\n" "createBootstrapAttributeSlots ::xotcl::ObjectParameterSlot {\n" -"{name \"[namespace tail [::xotcl::self]]\"}\n" +"{name \"[namespace tail [::xotcl::current object]]\"}\n" "{methodname}\n" -"{domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]\"}\n" +"{domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::current object]] 1]\"}\n" "{defaultmethods {get assign}}\n" -"{manager \"[::xotcl::self]\"}\n" +"{manager \"[::xotcl::current object]\"}\n" "{per-object false}}\n" "::xotcl::alias ::xotcl::ObjectParameterSlot get ::xotcl::setvar\n" "::xotcl::alias ::xotcl::ObjectParameterSlot assign ::xotcl::setvar\n" @@ -227,14 +227,14 @@ "if {[::xotcl2::Object info callable $m] ne \"\"} continue\n" "if {[string match __* $m]} continue\n" "lappend methods $m}\n" -"error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" +"error \"Method '$method' unknown for slot [[::xotcl::current object]; valid are: {[lsort $methods]]}\"}\n" "::xotcl::ObjectParameterSlot public method destroy {} {\n" "if {${:domain} ne \"\" && [::xotcl::objectproperty ${:domain} class]} {\n" "${:domain} __invalidateobjectparameter}\n" "next}\n" "::xotcl::ObjectParameterSlot protected method init {args} {\n" "if {${:domain} eq \"\"} {\n" -"set :domain [::xotcl::self callingobject]}\n" +"set :domain [::xotcl::current callingobject]}\n" "if {${:domain} ne \"\"} {\n" "if {![info exists :methodname]} {\n" "set :methodname ${:name}}\n" @@ -283,7 +283,7 @@ "if {$type ne \"\"} {\n" "set objopts [linsert $objopts 0 $type]\n" "set methodopts [linsert $methodopts 0 $type]}\n" -"lappend objopts slot=[self]\n" +"lappend objopts slot=[::xotcl::current object]\n" "if {[llength $objopts] > 0} {\n" "append objparamdefinition :[join $objopts ,]}\n" "if {[llength $methodopts] > 0} {\n" @@ -300,8 +300,8 @@ "lappend parameterdefinitions -$(oparam)}\n" "return $parameterdefinitions}\n" "::xotcl2::Object protected method objectparameter {} {\n" -"set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" -"if {[::xotcl::objectproperty [self] class]} {\n" +"set parameterdefinitions [::xotcl::parametersFromSlots [::xotcl::current object]]\n" +"if {[::xotcl::objectproperty [::xotcl::current object] class]} {\n" "lappend parameterdefinitions -parameter:method,optional}\n" "lappend parameterdefinitions \\\n" "-noinit:method,optional,noarg \\\n" @@ -327,7 +327,7 @@ "if {[string first :: $value] == -1} {\n" "if {![::xotcl::objectproperty $value object]} {\n" "error \"$value does not appear to be an object\"}\n" -"set value [::xotcl::dispatch $value -objscope ::xotcl::self]}\n" +"set value [::xotcl::dispatch $value -objscope ::xotcl::current object]}\n" "if {![::xotcl::objectproperty ${:elementtype} class]} {\n" "error \"$value does not appear to be of type ${:elementtype}\"}}\n" "set p [lsearch -exact $old $value]\n" @@ -371,7 +371,7 @@ "valuechangedcmd\n" "arg}\n" "::xotcl::Attribute method __default_from_cmd {obj cmd var sub op} {\n" -"$obj trace remove variable $var $op [list [::xotcl::self] [::xotcl::self proc] $obj $cmd]\n" +"$obj trace remove variable $var $op [list [::xotcl::current object] [::xotcl::current method] $obj $cmd]\n" "::xotcl::setvar $obj $var [$obj eval $cmd]}\n" "::xotcl::Attribute method __value_from_cmd {obj cmd var sub op} {\n" "::xotcl::setvar $obj $var [$obj eval $cmd]}\n" @@ -382,18 +382,18 @@ "set __initcmd \"\"\n" "if {[:exists default]} {} elseif [:exists initcmd] {\n" "append __initcmd \":trace add variable [list ${:name}] read \\\n" -"\\[list [::xotcl::self] __default_from_cmd \\[::xotcl::self\\] [list [set :initcmd]]\\]\\n\"} elseif [:exists valuecmd] {\n" +"\\[list [::xotcl::current object] __default_from_cmd \\[::xotcl::current object\\] [list [set :initcmd]]\\]\\n\"} elseif [:exists valuecmd] {\n" "append __initcmd \":trace add variable [list ${:name}] read \\\n" -"\\[list [::xotcl::self] __value_from_cmd \\[::xotcl::self\\] [list [set :valuecmd]]\\]\"}\n" +"\\[list [::xotcl::current object] __value_from_cmd \\[::xotcl::current object\\] [list [set :valuecmd]]\\]\"}\n" "array set \"\" [:toParameterSyntax ${:name}]\n" "if {$(mparam) ne \"\"} {\n" "if {[info exists :multivalued] && ${:multivalued}} {\n" -":method assign [list obj var value:$(mparam),multivalued,slot=[self]] {::xotcl::setvar $obj $var $value}\n" -":method add [list obj prop value:$(mparam),slot=[self] {pos 0}] {next}} else {\n" -":method assign [list obj var value:$(mparam),slot=[self]] {::xotcl::setvar $obj $var $value}}}\n" +":method assign [list obj var value:$(mparam),multivalued,slot=[::xotcl::current object]] {::xotcl::setvar $obj $var $value}\n" +":method add [list obj prop value:$(mparam),slot=[::xotcl::current object] {pos 0}] {next}} else {\n" +":method assign [list obj var value:$(mparam),slot=[::xotcl::current object]] {::xotcl::setvar $obj $var $value}}}\n" "if {[:exists valuechangedcmd]} {\n" "append __initcmd \":trace add variable [list ${:name}] write \\\n" -"\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [set :valuechangedcmd]]\\]\"}\n" +"\\[list [::xotcl::current object] __value_changed_cmd \\[::xotcl::current object\\] [list [set :valuechangedcmd]]\\]\"}\n" "if {$__initcmd ne \"\"} {\n" "set :initcmd $__initcmd}}\n" "::xotcl2::Class create ::xotcl::Attribute::Optimizer {\n" @@ -425,13 +425,13 @@ "::xotcl::setter ${:domain} {*}$perObject $setterParam}}\n" "::xotcl::Attribute mixin add ::xotcl::Attribute::Optimizer\n" "::xotcl2::Class method attribute {spec {-slotclass ::xotcl::Attribute} {initblock \"\"}} {\n" -"$slotclass createFromParameterSyntax [self] -initblock $initblock {*}$spec}\n" +"$slotclass createFromParameterSyntax [::xotcl::current object] -initblock $initblock {*}$spec}\n" "::xotcl2::Object method attribute {spec {-slotclass ::xotcl::Attribute} {initblock \"\"}} {\n" -"$slotclass createFromParameterSyntax [self] -per-object -initblock $initblock {*}$spec}\n" +"$slotclass createFromParameterSyntax [::xotcl::current object] -per-object -initblock $initblock {*}$spec}\n" "::xotcl2::Class public method parameter arglist {\n" "foreach arg $arglist {\n" -"::xotcl::Attribute createFromParameterSyntax [self] {*}$arg}\n" -"::xotcl::setvar [::xotcl::self]::slot __parameter $arglist}\n" +"::xotcl::Attribute createFromParameterSyntax [::xotcl::current object] {*}$arg}\n" +"::xotcl::setvar [::xotcl::current object]::slot __parameter $arglist}\n" "proc createBootstrapAttributeSlots {} {}\n" "::xotcl::Slot method type=hasmixin {name value arg} {\n" "if {![::xotcl::objectproperty $value hasmixin $arg]} {\n" @@ -450,7 +450,7 @@ ":attribute container\n" ":protected method init {} {\n" ":public method new {-childof args} {\n" -"::xotcl::importvar [::xotcl::self class] {container object} withclass\n" +"::xotcl::importvar [::xotcl::current class] {container object} withclass\n" "if {![::xotcl::objectproperty $object object]} {\n" "$withclass create $object}\n" "eval ::xotcl::next -childof $object $args}}}\n" @@ -459,7 +459,7 @@ "-object\n" "{-class ::xotcl2::Object}\n" "cmds} {\n" -"if {![info exists object]} {set object [::xotcl::self]}\n" +"if {![info exists object]} {set object [::xotcl::current object]}\n" "if {![::xotcl::objectproperty $object object]} {$class create $object}\n" "$object requireNamespace\n" "if {$withnew} {\n" @@ -472,7 +472,7 @@ "if {[::xotcl::objectproperty ::xotcl::Class class]} {::xotcl::Class instmixin delete $m}} else {\n" "namespace eval $object $cmds}}\n" "::xotcl2::Class forward slots %self contains \\\n" -"-object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot}\n" +"-object {%::xotcl::dispatch [::xotcl::current object] -objscope ::subst [::xotcl::current object]::slot}\n" "::xotcl2::Class create ::xotcl::CopyHandler {\n" ":attribute {targetList \"\"}\n" ":attribute {dest \"\"}\n" @@ -542,16 +542,16 @@ ":makeTargetList $obj\n" ":copyTargets}}\n" "::xotcl2::Object public method copy newName {\n" -"if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" -"[::xotcl::CopyHandler new -volatile] copy [::xotcl::self] $newName}}\n" +"if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::current object] :]]} {\n" +"[::xotcl::CopyHandler new -volatile] copy [::xotcl::current object] $newName}}\n" "::xotcl2::Object public method move newName {\n" -"if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" +"if {[string trimleft $newName :] ne [string trimleft [::xotcl::current object] :]} {\n" "if {$newName ne \"\"} {\n" ":copy $newName}\n" -"if {[::xotcl::objectproperty [::xotcl::self] class] && $newName ne \"\"} {\n" +"if {[::xotcl::objectproperty [::xotcl::current object] class] && $newName ne \"\"} {\n" "foreach subclass [:info subclass] {\n" "set scl [$subclass info superclass]\n" -"if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} {\n" +"if {[set index [lsearch -exact $scl [::xotcl::current object]]] != -1} {\n" "set scl [lreplace $scl $index $index $newName]\n" "$subclass superclass $scl}} }\n" ":destroy}}\n" Index: generic/predefined.xotcl =================================================================== diff -u -r1f1067f1a36bee1c928bb28c5284f53bf422c6dd -rd16b1ff12a9ab1dd196bbdb33510ad94959155b3 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 1f1067f1a36bee1c928bb28c5284f53bf422c6dd) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision d16b1ff12a9ab1dd196bbdb33510ad94959155b3) @@ -52,7 +52,7 @@ set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::xotcl::method [self] $name $arguments $body {*}$conditions + ::xotcl::method [::xotcl::current object] $name $arguments $body {*}$conditions } ::xotcl::method Object method { @@ -61,7 +61,7 @@ set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::xotcl::method [self] -per-object $name $arguments $body {*}$conditions + ::xotcl::method [::xotcl::current object] -per-object $name $arguments $body {*}$conditions } # define method modifiers "object", "public" and "protected" @@ -70,26 +70,26 @@ # method-modifier for object specific methos :method object {what args} { if {$what in [list "alias" "attribute" "forward" "method" "setter"]} { - return [::xotcl::dispatch [self] ::xotcl::classes::xotcl2::Object::$what {*}$args] + return [::xotcl::dispatch [::xotcl::current object] ::xotcl::classes::xotcl2::Object::$what {*}$args] } if {$what in [list "info"]} { - return [::xotcl2::objectInfo [lindex $args 0] [self] {*}[lrange $args 1 end]] + return [::xotcl2::objectInfo [lindex $args 0] [::xotcl::current object] {*}[lrange $args 1 end]] } if {$what in [list "filter" "mixin"]} { return [:object-$what {*}$args] } if {$what in [list "filterguard" "mixinguard"]} { - return [::xotcl::dispatch [self] ::xotcl::cmd::Object::$what {*}$args] + return [::xotcl::dispatch [::xotcl::current object] ::xotcl::cmd::Object::$what {*}$args] } } # define unknown handler for class :method unknown {m args} { - error "Method '$m' unknown for [self].\ - Consider '[self] create $m $args' instead of '[self] $m $args'" + error "Method '$m' unknown for [::xotcl::current object].\ + Consider '[::xotcl::current object] create $m $args' instead of '[::xotcl::current object] $m $args'" } # protected is not jet defined - ::xotcl::methodproperty [self] unknown protected 1 + ::xotcl::methodproperty [::xotcl::current object] unknown protected 1 } @@ -100,7 +100,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] - ::xotcl::methodproperty [self] $r protected false + ::xotcl::methodproperty [::xotcl::current object] $r protected false return $r } @@ -109,22 +109,22 @@ set p [lsearch -regexp $args {^(method|alias|attribute|forward|setter)$}] if {$p == -1} {error "$args is not a method defining command"} set r [{*}:$args] - ::xotcl::methodproperty [self] $r [self proc] true + ::xotcl::methodproperty [::xotcl::current object] $r [::xotcl::current method] true return $r } # unknown handler for Object :protected method unknown {m args} { - if {![self isnext]} { - error "[self]: unable to dispatch method '$m'" + if {![::xotcl::current isnext]} { + error "[::xotcl::current object]: 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 {} {::xotcl::self} + :protected method defaultmethod {} {::xotcl::current object} # provide a placeholder for the bootup process. The real definition # is based on slots, which are not available at this point. @@ -150,13 +150,13 @@ # -objscope implies -nonleaf # Object public method alias {-nonleaf:switch -objscope:switch methodName cmd} { - ::xotcl::alias [self] -per-object $methodName \ + ::xotcl::alias [::xotcl::current object] -per-object $methodName \ {*}[expr {${objscope} ? "-objscope" : ""}] \ {*}[expr {${nonleaf} ? "-nonleaf" : ""}] \ $cmd } Class public method alias {-nonleaf:switch -objscope:switch methodName cmd} { - ::xotcl::alias [self] $methodName \ + ::xotcl::alias [::xotcl::current object] $methodName \ {*}[expr {${objscope} ? "-objscope" : ""}] \ {*}[expr {${nonleaf} ? "-nonleaf" : ""}] \ $cmd @@ -166,16 +166,16 @@ # Object public method setter {methodName value:optional} { if {[info exists value]} { - ::xotcl::setter [self] -per-object $methodName $value + ::xotcl::setter [::xotcl::current object] -per-object $methodName $value } else { - ::xotcl::setter [self] -per-object $methodName + ::xotcl::setter [::xotcl::current object] -per-object $methodName } } Class public method setter {methodName value:optional} { if {[info exists value]} { - ::xotcl::setter [self] $methodName $value + ::xotcl::setter [::xotcl::current object] $methodName $value } else { - ::xotcl::setter [self] $methodName + ::xotcl::setter [::xotcl::current object] $methodName } } @@ -195,15 +195,15 @@ # info info :public method info {obj} { set methods [list] - foreach name [::xotcl::cmd::ObjectInfo::methods [self]] { + foreach name [::xotcl::cmd::ObjectInfo::methods [::xotcl::current object]] { if {$name eq "unknown"} continue lappend methods $name } return "valid options are: [join [lsort $methods] {, }]" } :method unknown {method obj args} { - error "[::xotcl::self] unknown info option \"$method\"; [$obj info info]" + error "[::xotcl::current object] unknown info option \"$method\"; [$obj info info]" } } @@ -246,7 +246,7 @@ error "invalid method type '$methtype', must be 'method'" } set body " - if {!\[::xotcl::self isnextcall\]} { + if {!\[::xotcl::current isnextcall\]} { error \"Abstract method $methname $arglist called\" } else {::xotcl::next} " @@ -339,7 +339,7 @@ } # ::xotcl::MetaSlot public method new args { - # set slotobject [::xotcl::self callingobject]::slot + # set slotobject [::xotcl::current callingobject]::slot # if {![::xotcl::objectproperty $slotobject object]} {::xotcls::Object create $slotobject} # eval next -childof $slotobject $args # } @@ -411,11 +411,11 @@ } createBootstrapAttributeSlots ::xotcl::ObjectParameterSlot { - {name "[namespace tail [::xotcl::self]]"} + {name "[namespace tail [::xotcl::current object]]"} {methodname} - {domain "[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]"} + {domain "[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::current object]] 1]"} {defaultmethods {get assign}} - {manager "[::xotcl::self]"} + {manager "[::xotcl::current object]"} {per-object false} } # maybe add the following slots at some later time here @@ -451,7 +451,7 @@ if {[string match __* $m]} continue lappend methods $m } - error "Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}" + error "Method '$method' unknown for slot [[::xotcl::current object]; valid are: {[lsort $methods]]}" } ::xotcl::ObjectParameterSlot public method destroy {} { @@ -463,7 +463,7 @@ ::xotcl::ObjectParameterSlot protected method init {args} { if {${:domain} eq ""} { - set :domain [::xotcl::self callingobject] + set :domain [::xotcl::current callingobject] } if {${:domain} ne ""} { if {![info exists :methodname]} { @@ -476,7 +476,7 @@ ::xotcl::setvar ${:domain} ${:name} ${:default} } set cl [expr {${:per-object} ? "Object" : "Class"}] - #puts stderr "Slot [self] init, forwarder on ${:domain}" + #puts stderr "Slot [::xotcl::current object] init, forwarder on ${:domain}" ::xotcl::forward ${:domain} ${:name} \ ${:manager} \ [list %1 [${:manager} defaultmethods]] %self \ @@ -549,7 +549,7 @@ set objopts [linsert $objopts 0 $type] set methodopts [linsert $methodopts 0 $type] } - lappend objopts slot=[self] + lappend objopts slot=[::xotcl::current object] if {[llength $objopts] > 0} { append objparamdefinition :[join $objopts ,] @@ -560,7 +560,7 @@ if {[info exists arg]} { lappend objparamdefinition $arg } - #puts stderr "[self proc] ${name} returns [list oparam $objparamdefinition mparam $methodparamdefinition]" + #puts stderr "[::xotcl::current method] ${name} returns [list oparam $objparamdefinition mparam $methodparamdefinition]" return [list oparam $objparamdefinition mparam $methodparamdefinition] } @@ -579,16 +579,16 @@ } ::xotcl2::Object protected method objectparameter {} { - #puts stderr "... objectparameter [self]" - set parameterdefinitions [::xotcl::parametersFromSlots [self]] - if {[::xotcl::objectproperty [self] class]} { + #puts stderr "... objectparameter [::xotcl::current object]" + set parameterdefinitions [::xotcl::parametersFromSlots [::xotcl::current object]] + if {[::xotcl::objectproperty [::xotcl::current object] class]} { lappend parameterdefinitions -parameter:method,optional } lappend parameterdefinitions \ -noinit:method,optional,noarg \ -volatile:method,optional,noarg \ arg:initcmd,optional - #puts stderr "*** parameter definition for [self]: $parameterdefinitions" + #puts stderr "*** parameter definition for [::xotcl::current object]: $parameterdefinitions" return $parameterdefinitions } @@ -626,7 +626,7 @@ if {![::xotcl::objectproperty $value object]} { error "$value does not appear to be an object" } - set value [::xotcl::dispatch $value -objscope ::xotcl::self] + set value [::xotcl::dispatch $value -objscope ::xotcl::current object] } if {![::xotcl::objectproperty ${:elementtype} class]} { error "$value does not appear to be of type ${:elementtype}" @@ -641,7 +641,7 @@ } ::xotcl::RelationSlot public method delete {-nocomplain:switch obj prop value} { - #puts stderr RelationSlot-delete-[self args] + #puts stderr RelationSlot-delete-[::xotcl::current args] $obj $prop [:delete_value $obj $prop [$obj info $prop] $value] } @@ -704,12 +704,12 @@ } ::xotcl::Attribute method __default_from_cmd {obj cmd var sub op} { - #puts "GETVAR [::xotcl::self proc] obj=$obj cmd=$cmd, var=$var, op=$op" - $obj trace remove variable $var $op [list [::xotcl::self] [::xotcl::self proc] $obj $cmd] + #puts "GETVAR [::xotcl::current method] obj=$obj cmd=$cmd, var=$var, op=$op" + $obj trace remove variable $var $op [list [::xotcl::current object] [::xotcl::current method] $obj $cmd] ::xotcl::setvar $obj $var [$obj eval $cmd] } ::xotcl::Attribute method __value_from_cmd {obj cmd var sub op} { - #puts "GETVAR [::xotcl::self proc] obj=$obj cmd=$cmd, var=$var, op=$op" + #puts "GETVAR [::xotcl::current method] obj=$obj cmd=$cmd, var=$var, op=$op" ::xotcl::setvar $obj $var [$obj eval $cmd] } ::xotcl::Attribute method __value_changed_cmd {obj cmd var sub op} { @@ -724,30 +724,30 @@ if {[:exists default]} { } elseif [:exists initcmd] { append __initcmd ":trace add variable [list ${:name}] read \ - \[list [::xotcl::self] __default_from_cmd \[::xotcl::self\] [list [set :initcmd]]\]\n" + \[list [::xotcl::current object] __default_from_cmd \[::xotcl::current object\] [list [set :initcmd]]\]\n" } elseif [:exists valuecmd] { append __initcmd ":trace add variable [list ${:name}] read \ - \[list [::xotcl::self] __value_from_cmd \[::xotcl::self\] [list [set :valuecmd]]\]" + \[list [::xotcl::current object] __value_from_cmd \[::xotcl::current object\] [list [set :valuecmd]]\]" } array set "" [:toParameterSyntax ${:name}] - #puts stderr "Attribute.init valueParam for [self] is $(mparam)" + #puts stderr "Attribute.init valueParam for [::xotcl::current object] is $(mparam)" if {$(mparam) ne ""} { if {[info exists :multivalued] && ${:multivalued}} { - #puts stderr "adding assign [list obj var value:$(mparam),multivalued] // for [self] with $(mparam)" - :method assign [list obj var value:$(mparam),multivalued,slot=[self]] {::xotcl::setvar $obj $var $value} - #puts stderr "adding add method for [self] with value:$(mparam)" - :method add [list obj prop value:$(mparam),slot=[self] {pos 0}] {next} + #puts stderr "adding assign [list obj var value:$(mparam),multivalued] // for [::xotcl::current object] with $(mparam)" + :method assign [list obj var value:$(mparam),multivalued,slot=[::xotcl::current object]] {::xotcl::setvar $obj $var $value} + #puts stderr "adding add method for [::xotcl::current object] with value:$(mparam)" + :method add [list obj prop value:$(mparam),slot=[::xotcl::current object] {pos 0}] {next} } else { - #puts stderr "adding assign [list obj var value:$(mparam)] // for [self] with $(mparam)" - :method assign [list obj var value:$(mparam),slot=[self]] {::xotcl::setvar $obj $var $value} - #::xotcl::setter ${:domain} ${:name}:$(mparam),slot=[self] - #puts stderr "::xotcl::setter ${:domain} ${:name}:$(mparam),slot=[self]" + #puts stderr "adding assign [list obj var value:$(mparam)] // for [::xotcl::current object] with $(mparam)" + :method assign [list obj var value:$(mparam),slot=[::xotcl::current object]] {::xotcl::setvar $obj $var $value} + #::xotcl::setter ${:domain} ${:name}:$(mparam),slot=[::xotcl::current object] + #puts stderr "::xotcl::setter ${:domain} ${:name}:$(mparam),slot=[::xotcl::current object]" } } if {[:exists valuechangedcmd]} { append __initcmd ":trace add variable [list ${:name}] write \ - \[list [::xotcl::self] __value_changed_cmd \[::xotcl::self\] [list [set :valuechangedcmd]]\]" + \[list [::xotcl::current object] __value_changed_cmd \[::xotcl::current object\] [list [set :valuechangedcmd]]\]" } if {$__initcmd ne ""} { set :initcmd $__initcmd @@ -803,10 +803,10 @@ # Define method "attribute" for convenience ############################################ ::xotcl2::Class method attribute {spec {-slotclass ::xotcl::Attribute} {initblock ""}} { - $slotclass createFromParameterSyntax [self] -initblock $initblock {*}$spec + $slotclass createFromParameterSyntax [::xotcl::current object] -initblock $initblock {*}$spec } ::xotcl2::Object method attribute {spec {-slotclass ::xotcl::Attribute} {initblock ""}} { - $slotclass createFromParameterSyntax [self] -per-object -initblock $initblock {*}$spec + $slotclass createFromParameterSyntax [::xotcl::current object] -per-object -initblock $initblock {*}$spec } ############################################ # Define method "parameter" for backward @@ -815,10 +815,10 @@ ::xotcl2::Class public method parameter arglist { foreach arg $arglist { - ::xotcl::Attribute createFromParameterSyntax [self] {*}$arg + ::xotcl::Attribute createFromParameterSyntax [::xotcl::current object] {*}$arg } # todo needed? - ::xotcl::setvar [::xotcl::self]::slot __parameter $arglist + ::xotcl::setvar [::xotcl::current object]::slot __parameter $arglist } ################################################################## @@ -869,7 +869,7 @@ :protected method init {} { :public method new {-childof args} { - ::xotcl::importvar [::xotcl::self class] {container object} withclass + ::xotcl::importvar [::xotcl::current class] {container object} withclass if {![::xotcl::objectproperty $object object]} { $withclass create $object } @@ -891,7 +891,7 @@ {-class ::xotcl2::Object} cmds } { - if {![info exists object]} {set object [::xotcl::self]} + if {![info exists object]} {set object [::xotcl::current object]} if {![::xotcl::objectproperty $object object]} {$class create $object} $object requireNamespace if {$withnew} { @@ -908,7 +908,7 @@ } } ::xotcl2::Class forward slots %self contains \ - -object {%::xotcl::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot} + -object {%::xotcl::dispatch [::xotcl::current object] -objscope ::subst [::xotcl::current object]::slot} ################################################################## # copy/move implementation @@ -1029,7 +1029,7 @@ } :public method copy {obj dest} { - #puts stderr "[::xotcl::self] copy <$obj> <$dest>" + #puts stderr "[::xotcl::current object] copy <$obj> <$dest>" set :objLength [string length $obj] set :dest $dest :makeTargetList $obj @@ -1039,21 +1039,21 @@ ::xotcl2::Object public method copy newName { - if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} { - [::xotcl::CopyHandler new -volatile] copy [::xotcl::self] $newName + if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::current object] :]]} { + [::xotcl::CopyHandler new -volatile] copy [::xotcl::current object] $newName } } ::xotcl2::Object public method move newName { - if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} { + if {[string trimleft $newName :] ne [string trimleft [::xotcl::current object] :]} { if {$newName ne ""} { :copy $newName } ### let all subclasses get the copied class as superclass - if {[::xotcl::objectproperty [::xotcl::self] class] && $newName ne ""} { + if {[::xotcl::objectproperty [::xotcl::current object] class] && $newName ne ""} { foreach subclass [:info subclass] { set scl [$subclass info superclass] - if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} { + if {[set index [lsearch -exact $scl [::xotcl::current object]]] != -1} { set scl [lreplace $scl $index $index $newName] $subclass superclass $scl }