Index: xotcl/generic/predefined.h =================================================================== diff -u -rbb3c756fb47517596b9dbcb4e580aa1212827b41 -r2846921e448d4d4aeb3245ebbfe4381182f0e286 --- xotcl/generic/predefined.h (.../predefined.h) (revision bb3c756fb47517596b9dbcb4e580aa1212827b41) +++ xotcl/generic/predefined.h (.../predefined.h) (revision 2846921e448d4d4aeb3245ebbfe4381182f0e286) @@ -1,19 +1,74 @@ static char cmd[] = -"# $Id: predefined.h,v 1.10 2006/09/14 06:36:02 neumann Exp $\n" -"foreach cmd [info command ::xotcl::Object::instcmd::*] {\n" -"::xotcl::alias ::xotcl::Object [namespace tail $cmd] $cmd}\n" -"foreach cmd {array append eval incr lappend trace subst unset} {\n" -"::xotcl::alias ::xotcl::Object $cmd -objscope ::$cmd}\n" -"foreach cmd [info command ::xotcl::Class::instcmd::*] {\n" -"::xotcl::alias ::xotcl::Class [namespace tail $cmd] $cmd}\n" -"unset cmd\n" +"# $Id: predefined.h,v 1.11 2006/09/25 08:29:04 neumann Exp $\n" "::xotcl::Object instproc init args {}\n" "::xotcl::Object create ::xotcl::@\n" "::xotcl::@ proc unknown args {}\n" -"proc ::xotcl::myproc {args} {linsert $args 0 [::xotcl::self]}\n" -"proc ::xotcl::myvar {var} {::xotcl::my requireNamespace; return [::xotcl::self]::$var}\n" -"namespace eval ::xotcl { namespace export @ myproc myvar Attribute}\n" -"::xotcl::setrelation ::xotcl::Class::Parameter superclass ::xotcl::Class\n" +"namespace eval ::xotcl { namespace export @ }\n" +"foreach cmd {array append lappend trace eval unset} {\n" +"::xotcl::Object instforward $cmd -objscope}\n" +"unset cmd\n" +"::xotcl::Object instproc tclcmd {t} {\n" +"set cmd [list [::xotcl::self] forward $t -objscope]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Class instproc insttclcmd {t} {\n" +"set cmd [list [::xotcl::self] instforward $t -objscope]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Class ::xotcl::Relations\n" +"::xotcl::Relations instproc get {obj prop} {$obj info $prop}\n" +"::xotcl::Relations instproc set {obj prop value} {::xotcl::setrelation $obj $prop $value}\n" +"::xotcl::Relations instproc add {obj prop value {pos 0}} {\n" +"$obj $prop [linsert [$obj info $prop -guards] $pos $value]}\n" +"::xotcl::Relations instproc delete {-nocomplain:switch obj prop value} {\n" +"set old [$obj info $prop]\n" +"set p [lsearch -glob $old $value]\n" +"if {$p>-1} {$obj $prop [lreplace $old $p $p]} else {\n" +"error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" +"::xotcl::Relations instproc unknown {m args} {\n" +"puts \"method '$m' unknown for [self]\"\n" +"puts \" valid commands are: {[lsort [my info procs]]}\"}\n" +"::xotcl::Relations create ::xotcl::relmgr -requireNamespace\n" +"::xotcl::Object instforward mixin -default [list get set] ::xotcl::relmgr %1 %self %proc\n" +"::xotcl::Object instforward filter -default [list get set] ::xotcl::relmgr %1 %self %proc\n" +"::xotcl::Class instforward instmixin -default [list get set] ::xotcl::relmgr %1 %self %proc\n" +"::xotcl::Class instforward instfilter -default [list get set] ::xotcl::relmgr %1 %self %proc\n" +"::xotcl::Object instproc self {} {return [::xotcl::self]}\n" +"::xotcl::Object instproc defaultmethod {} {\n" +"return [::xotcl::self]}\n" +"::xotcl::Object instproc filterappend f {\n" +"set cmd [list [::xotcl::self] filter add $f end]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Object instproc mixinappend m {\n" +"set cmd [list [::xotcl::self] mixin add $m end]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Class instproc instfilterappend f {\n" +"set cmd [list [::xotcl::self] instfilter add $f end]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Class instproc instmixinappend m {\n" +"set cmd [list [::xotcl::self] instmixin add $m end]\n" +"puts stderr \"the method [::xotcl::self proc] is deprecated; use instead '$cmd'\"\n" +"eval $cmd}\n" +"::xotcl::Object instproc hasclass cl {\n" +"if {[::xotcl::my ismixin $cl]} {return 1}\n" +"::xotcl::my istype $cl}\n" +"::xotcl::Class instproc allinstances {} {\n" +"set set [::xotcl::my info instances]\n" +"foreach sc [::xotcl::my info subclass] {\n" +"eval lappend set [$sc allinstances]}\n" +"return $set}\n" +"::xotcl::Object proc unsetExitHandler {} {\n" +"::xotcl::Object proc __exitHandler {} {\n" +";}}\n" +"::xotcl::Object unsetExitHandler\n" +"::xotcl::Object proc setExitHandler {newbody} {\n" +"::xotcl::Object proc __exitHandler {} $newbody}\n" +"::xotcl::Object proc getExitHandler {} {\n" +"::xotcl::Object info body __exitHandler}\n" +"::xotcl::Class::Parameter superclass ::xotcl::Class\n" "::xotcl::Class::Parameter instproc mkParameter {obj name args} {\n" "if {[$obj exists $name]} {\n" "eval [$obj set $name] configure $args} else {\n" @@ -36,212 +91,26 @@ "::xotcl::my set access $obj\n" "::xotcl::my set extra \\[::xotcl::self\\]\n" "foreach v [$obj info vars] {::xotcl::my set $v [$obj set $v]}}\n" -"::xotcl::Class::Parameter proc values {param args} {\n" -"set cl [::xotcl::my set cl]\n" -"set ci [$cl info instinvar]\n" -"set valueTest {}\n" -"foreach a $args {\n" -"::lappend valueTest \"\\[\\$cl set $param\\] == [list $a]\"}\n" -"::lappend ci [join $valueTest \" || \"]\n" -"$cl instinvar $ci}\n" -"::xotcl::Class create ::xotcl::MetaSlot\n" -"::xotcl::setrelation ::xotcl::MetaSlot superclass ::xotcl::Class\n" -"::xotcl::MetaSlot instproc new args {\n" -"set slotobject [self callingobject]::slot\n" -"if {![my isobject $slotobject]} {Object create $slotobject}\n" -"eval next -childof $slotobject $args}\n" -"::xotcl::MetaSlot create ::xotcl::Slot -array set __defaults {\n" -"name \"[namespace tail [::xotcl::self]]\"\n" -"domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]\"\n" -"defaultmethods {get assign}\n" -"manager \"[::xotcl::self]\"\n" -"multivalued false\n" -"per-object false}\n" -"foreach p {name domain defaultmethods manager default multivalued type\n" -"per-object initcmd valuecmd valuechangedcmd} {\n" -"::xotcl::Slot instparametercmd $p}\n" -"unset p\n" -"::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" -"::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\n" -"::xotcl::Slot instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" -"if {[$obj exists $prop]} {\n" -"$obj set $prop [linsert [$obj set $prop] $pos $value]} else {\n" -"$obj set $prop [list $value]}}\n" -"::xotcl::Slot instproc delete {-nocomplain:switch obj prop value} {\n" -"set old [$obj set $prop]\n" -"set p [lsearch -glob $old $value]\n" -"if {$p>-1} {$obj set $prop [lreplace $old $p $p]} else {\n" -"error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" -"::xotcl::Slot instproc unknown {method args} {\n" -"set methods [list]\n" -"foreach m [my info methods] {\n" -"if {[::xotcl::Object info methods $m] ne \"\"} continue\n" -"if {[string match __* $m]} continue\n" -"lappend methods $m}\n" -"error \"Method '$method' unknown for slot [self]; valid are: {[lsort $methods]]}\"}\n" -"::xotcl::Slot instproc init {} {\n" -"my instvar name domain manager\n" -"set forwarder [expr {[my per-object] ? \"forward\" : \"instforward\"}]\n" -"if {$domain eq \"\"} {\n" -"set domain [self callingobject]}\n" -"$domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc}\n" -"::xotcl::MetaSlot create ::xotcl::InfoSlot -array set __defaults {\n" -"multivalued true}\n" -"::xotcl::setrelation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" -"::xotcl::InfoSlot instproc get {obj prop} {$obj info $prop}\n" -"::xotcl::InfoSlot instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" -"$obj $prop [linsert [$obj info $prop] $pos $value]}\n" -"::xotcl::InfoSlot instproc delete {-nocomplain:switch obj prop value} {\n" -"set old [$obj info $prop]\n" -"set p [lsearch -glob $old $value]\n" -"if {$p>-1} {$obj $prop [lreplace $old $p $p]} else {\n" -"error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" -"::xotcl::MetaSlot create ::xotcl::InterceptorSlot\n" -"::xotcl::setrelation ::xotcl::InterceptorSlot superclass ::xotcl::InfoSlot\n" -"::xotcl::alias ::xotcl::InterceptorSlot set ::xotcl::setrelation ;# for backwards compatibility\n" -"::xotcl::alias ::xotcl::InterceptorSlot assign ::xotcl::setrelation\n" -"::xotcl::InterceptorSlot instproc add {obj prop value {pos 0}} {\n" -"if {![my multivalued]} {\n" -"error \"Property $prop of [my domain]->$obj ist not multivalued\"}\n" -"$obj $prop [linsert [$obj info $prop -guards] $pos $value]}\n" -"namespace eval ::xotcl::Class::slot {}\n" -"namespace eval ::xotcl::Object::slot {}\n" -"::xotcl::InfoSlot create ::xotcl::Class::slot::superclass\n" -"::xotcl::alias ::xotcl::Class::slot::superclass assign ::xotcl::setrelation\n" -"::xotcl::InfoSlot create ::xotcl::Object::slot::class\n" -"::xotcl::alias ::xotcl::Object::slot::class assign ::xotcl::setrelation\n" -"::xotcl::InterceptorSlot create ::xotcl::Object::slot::mixin\n" -"::xotcl::InterceptorSlot create ::xotcl::Object::slot::filter\n" -"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instmixin\n" -"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter\n" -"::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::Slot\n" -"foreach p {default value_check initcmd valuecmd valuechangedcmd} {\n" -"::xotcl::Attribute instparametercmd $p}\n" -"unset p\n" -"::xotcl::Attribute array set __defaults {\n" -"value_check once}\n" -"::xotcl::Attribute instproc __default_from_cmd {obj cmd var sub op} {\n" -"$obj trace remove variable $var $op [list [self] [self proc] $obj $cmd]\n" -"$obj set $var [eval $cmd]}\n" -"::xotcl::Attribute instproc __value_from_cmd {obj cmd var sub op} {\n" -"puts \"GETVAR [self proc] obj=$obj cmd=$cmd, var=$var, op=$op\"\n" -"$obj set $var [eval $cmd]}\n" -"::xotcl::Attribute instproc __value_changed_cmd {obj cmd var sub op} {\n" -"eval $cmd}\n" -"::xotcl::Attribute instproc destroy {} {\n" -"next}\n" -"::xotcl::Attribute instproc check_single_value {\n" -"{-keep_old_value:boolean true}\n" -"value predicate type obj var} {\n" -"if {![expr $predicate]} {\n" -"if {[$obj exists __oldvalue($var)]} {\n" -"$obj set $var [$obj set __oldvalue($var)]} else {\n" -"$obj unset -nocomplain $var}\n" -"error \"$value is not of type $type\"}\n" -"if {$keep_old_value} {$obj set __oldvalue($var) $value}}\n" -"::xotcl::Attribute instproc check_multiple_values {values predicate type obj var} {\n" -"foreach value $values {\n" -"my check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" -"$obj set __oldvalue($var) $value}\n" -"::xotcl::Attribute instproc mk_type_checker {} {\n" -"set __initcmd \"\"\n" -"if {[my exists type]} {\n" -"my instvar type name\n" -"if {[::xotcl::Object isclass $type]} {\n" -"set predicate [subst -nocommands {[::xotcl::Object isobject \\$value]\n" -"&& [\\$value istype $type]}]} elseif {[llength $type]>1} {\n" -"set predicate \"\\[$type \\$value\\]\"} else {\n" -"set predicate \"\\[string is $type \\$value\\]\"}\n" -"my append valuechangedcmd [subst {\n" -"my [expr {[my multivalued] ? \"check_multiple_values\" : \"check_single_value\"}] \\[\\$obj set $name\\] \\\n" -"{$predicate} [list $type] \\$obj $name}]\n" -"append __initcmd [subst -nocommands {\n" -"if {[my exists $name]} {my set __oldvalue($name) [my set $name]}\\n}]}\n" -"return $__initcmd}\n" -"::xotcl::Attribute instproc init {} {\n" -"my instvar domain name\n" -"next ;# do first ordinary slot initialization\n" -"$domain unset -nocomplain __defaults($name)\n" -"set __initcmd \"\"\n" -"if {[my exists default]} {\n" -"$domain set __defaults($name) [my default]} elseif [my exists initcmd] {\n" -"append __initcmd \"my trace add variable [list $name] read \\\n" -"\\[list [self] __default_from_cmd \\[self\\] [list [my initcmd]]\\]\\n\"} elseif [my exists valuecmd] {\n" -"append __initcmd \"my trace add variable [list $name] read \\\n" -"\\[list [self] __value_from_cmd \\[self\\] [list [my valuecmd]]\\]\"}\n" -"append __initcmd [my mk_type_checker]\n" -"if {[my exists valuechangedcmd]} {\n" -"append __initcmd \"my trace add variable [list $name] write \\\n" -"\\[list [self] __value_changed_cmd \\[self\\] [list [my valuechangedcmd]]\\]\"}\n" -"if {$__initcmd ne \"\"} {\n" -"$domain set __initcmds($name) $__initcmd}}\n" -"::xotcl::Class create ::xotcl::Slot::Nocheck \\\n" -"-instproc check_single_value args {;} -instproc check_multiple_values args {;} \\\n" -"-instproc mk_type_checker args {return \"\"}\n" -"::xotcl::Class create ::xotcl::Slot::Optimizer \\\n" -"-instproc proc args {::xotcl::next; ::xotcl::my optimize} \\\n" -"-instproc forward args {::xotcl::next; ::xotcl::my optimize} \\\n" -"-instproc init args {::xotcl::next; ::xotcl::my optimize} \\\n" -"-instproc optimize {} {\n" -"if {[::xotcl::my multivalued]} return\n" -"if {[::xotcl::my defaultmethods] ne {get assign}} return\n" -"if {[::xotcl::my procsearch assign] ne \"::xotcl::Slot instcmd assign\"} return\n" -"if {[::xotcl::my procsearch get] ne \"::xotcl::Slot instcmd get\"} return\n" -"set forwarder [expr {[::xotcl::my per-object] ? \"parametercmd\":\"instparametercmd\"}]\n" -"[::xotcl::my domain] $forwarder [::xotcl::my name]}\n" -"::xotcl::Slot instmixin add ::xotcl::Slot::Optimizer\n" -"::xotcl::Class create ::xotcl::ScopedNew -superclass ::xotcl::Class \\\n" -"-array set __defaults {withclass ::xotcl::Object}\n" -"::xotcl::ScopedNew instparametercmd withclass\n" -"::xotcl::ScopedNew instparametercmd inobject\n" -"::xotcl::ScopedNew instproc init {} {\n" -"::xotcl::my instproc new args {\n" -"[::xotcl::self class] instvar {inobject object} withclass\n" -"if {![::xotcl::my isobject $object]} {\n" -"$withclass create $object}\n" -"eval ::xotcl::next -childof $object $args}}\n" -"::xotcl::Object instproc contains {\n" -"{-withnew:boolean true}\n" -"-object\n" -"{-class ::xotcl::Object}\n" -"cmds} {\n" -"if {![info exists object]} {set object [::xotcl::self]}\n" -"if {![::xotcl::my isobject $object]} {$class create $object}\n" -"$object requireNamespace\n" -"if {$withnew} {\n" -"set m [::xotcl::ScopedNew new \\\n" -"-inobject $object -withclass $class -volatile]\n" -"::xotcl::Class instmixin add $m\n" -"namespace eval $object $cmds\n" -"::xotcl::Class instmixin delete $m} else {\n" -"namespace eval $object $cmds}}\n" -"::xotcl::Class instforward slots %self contains \\\n" -"-object {%::xotcl::my subst [::xotcl::self]::slot}\n" -"::xotcl::Class instproc parameter arglist {\n" -"if {![::xotcl::my isobject [self]::slot]} {::xotcl::Object create [self]::slot}\n" -"foreach arg $arglist {\n" -"set l [llength $arg]\n" +"::xotcl::Class::Parameter proc mkGetterSetter {cl arg args} {\n" "set name [lindex $arg 0]\n" -"if {$l == 1} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name} elseif {$l == 2} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default [lindex $arg 1]} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default [lindex $arg 2]} else {\n" +"if {$name eq $arg} {\n" +"$cl instparametercmd $name\n" +"return}\n" +"if {[llength $arg] == 2} {\n" +"$cl set __defaults($name) [lindex $arg 1]\n" +"$cl instparametercmd $name\n" +"return}\n" "set paramstring [string range $arg [expr {[string length $name]+1}] end]\n" "if {[string match {[$\\[]*} $paramstring]} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default $paramstring\n" -"continue}\n" -"set po ::xotcl::Class::Parameter\n" -"puts stderr \"deprecated parameter usage '$arg'; use '-slots {Attribute ...}' instead\"\n" -"$po set name $name\n" -"$po set cl [self]\n" -"::eval $po configure [lrange $arg 1 end]\n" -"if {[$po exists extra] || [$po exists setter] ||\n" -"[$po exists getter] || [$po exists access]} {\n" -"$po instvar extra setter getter access defaultParam\n" +"$cl set __defaults($name) $paramstring\n" +"$cl instparametercmd $name\n" +"return}\n" +"::xotcl::my set name $name\n" +"::xotcl::my set cl $cl\n" +"::eval ::xotcl::my configure [lrange $arg 1 end]\n" +"if {[::xotcl::my exists extra] || [::xotcl::my exists setter] ||\n" +"[::xotcl::my exists getter] || [::xotcl::my exists access]} {\n" +"::xotcl::my instvar extra setter getter access defaultParam\n" "if {![info exists extra]} {set extra \"\"}\n" "if {![info exists defaultParam]} {set defaultParam \"\"}\n" "if {![info exists setter]} {set setter set}\n" @@ -252,28 +121,16 @@ "return \\[$access $getter $extra $name\\]} else {\n" "return \\[eval $access $setter $extra $name \\$args $defaultParam \\]}\"\n" "foreach instvar {extra defaultParam setter getter access} {\n" -"$po unset -nocomplain $instvar}} else {\n" -"::xotcl::my instparametercmd $name}}}\n" -"[self]::slot set __parameter $arglist}\n" -"::xotcl::Object instproc self {} {::xotcl::self}\n" -"::xotcl::Object instproc defaultmethod {} {\n" -"return [::xotcl::self]}\n" -"::xotcl::Object instproc hasclass cl {\n" -"if {[::xotcl::my ismixin $cl]} {return 1}\n" -"::xotcl::my istype $cl}\n" -"::xotcl::Class instproc allinstances {} {\n" -"set set [::xotcl::my info instances]\n" -"foreach sc [::xotcl::my info subclass] {\n" -"eval lappend set [$sc allinstances]}\n" -"return $set}\n" -"::xotcl::Object proc unsetExitHandler {} {\n" -"::xotcl::Object proc __exitHandler {} {\n" -";}}\n" -"::xotcl::Object unsetExitHandler\n" -"::xotcl::Object proc setExitHandler {newbody} {\n" -"::xotcl::Object proc __exitHandler {} $newbody}\n" -"::xotcl::Object proc getExitHandler {} {\n" -"::xotcl::Object info body __exitHandler}\n" +"if {[::xotcl::my exists $instvar]} {::xotcl::my unset $instvar}}} else {\n" +"$cl instparametercmd $name}}\n" +"::xotcl::Class::Parameter proc values {param args} {\n" +"set cl [::xotcl::my set cl]\n" +"set ci [$cl info instinvar]\n" +"set valueTest {}\n" +"foreach a $args {\n" +"::lappend valueTest \"\\[\\$cl set $param\\] == [list $a]\"}\n" +"::lappend ci [join $valueTest \" || \"]\n" +"$cl instinvar $ci}\n" "::xotcl::Object instproc abstract {methtype methname arglist} {\n" "if {$methtype ne \"proc\" && $methtype ne \"instproc\"} {\n" "error \"invalid method type '$methtype', \\\n" @@ -312,6 +169,7 @@ "set obj $cl\n" "$cl superclass [$origin info superclass]\n" "$cl parameterclass [$origin info parameterclass]\n" +"$cl parameter [$origin info parameter]\n" "$cl instinvar [$origin info instinvar]\n" "$cl instfilter [$origin info instfilter -guards]\n" "$cl instmixin [$origin info instmixin]\n" @@ -324,13 +182,7 @@ "if {[$origin info hasNamespace]} {\n" "$obj requireNamespace}} else {\n" "namespace eval $dest {}}\n" -"::xotcl::my copyNSVarsAndCmds $origin $dest}\n" -"set origin [lindex [::xotcl::my set targetList] 0]\n" -"if {[::xotcl::my isclass $origin]} {\n" -"foreach oldslot [$origin info slots] {\n" -"set newslot ${cl}::slot::[namespace tail $oldslot]\n" -"if {[$oldslot domain] eq $origin} {$newslot domain $cl}\n" -"if {[$oldslot manager] eq $oldslot} {$newslot manager $newslot}}}}\n" +"::xotcl::my copyNSVarsAndCmds $origin $dest}}\n" "::xotcl::Object::CopyHandler instproc copy {obj dest} {\n" "::xotcl::my set objLength [string length $obj]\n" "::xotcl::my set dest $dest\n" @@ -340,7 +192,7 @@ "if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" "[[::xotcl::self class]::CopyHandler new -volatile] copy [::xotcl::self] $newName}}\n" "::xotcl::Object instproc move newName {\n" -"if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" +"if {[string compare [string trimleft $newName :] [string trimleft [::xotcl::self] :]]} {\n" "if {$newName ne \"\"} {\n" "::xotcl::my copy $newName}\n" "if {[::xotcl::my isclass [::xotcl::self]] && $newName ne \"\"} {\n"