Index: generic/predefined.h =================================================================== diff -u -r030722ec041bcc7a731eff1fdea9afa15a9b91a0 -rba41800193462bb1c6673f4774b56c9829cc991a --- generic/predefined.h (.../predefined.h) (revision 030722ec041bcc7a731eff1fdea9afa15a9b91a0) +++ generic/predefined.h (.../predefined.h) (revision ba41800193462bb1c6673f4774b56c9829cc991a) @@ -138,7 +138,7 @@ "::xotcl::relation ::xotcl::MetaSlot superclass ::xotcl2::Class\n" "::xotcl::MetaSlot public method slotName {name baseObject} {\n" "set slotParent ${baseObject}::slot\n" -"if {![::xotcl::is ${slotParent} object]} {\n" +"if {![::xotcl::objectproperty ${slotParent} object]} {\n" "::xotcl2::Object create ${slotParent}}\n" "return ${slotParent}::$name}\n" "::xotcl::MetaSlot method createFromParameterSyntax {target -per-object:switch {-initblock \"\"} value default:optional} {\n" @@ -227,7 +227,7 @@ "lappend methods $m}\n" "error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" "::xotcl::ObjectParameterSlot public method destroy {} {\n" -"if {${:domain} ne \"\" && [::xotcl::is ${:domain} class]} {\n" +"if {${:domain} ne \"\" && [::xotcl::objectproperty ${:domain} class]} {\n" "${:domain} __invalidateobjectparameter}\n" "next}\n" "::xotcl::ObjectParameterSlot protected method init {args} {\n" @@ -236,7 +236,7 @@ "if {${:domain} ne \"\"} {\n" "if {![info exists :methodname]} {\n" "set :methodname ${:name}}\n" -"if {[::xotcl::is ${:domain} class]} {\n" +"if {[::xotcl::objectproperty ${:domain} class]} {\n" "${:domain} __invalidateobjectparameter}\n" "if {${:per-object} && [info exists :default] } {\n" "::xotcl::setinstvar ${:domain} ${:name} ${:default}}\n" @@ -257,7 +257,7 @@ "lappend methodopts required}\n" "if {[info exists :type]} {\n" "if {[string match ::* ${:type}]} {\n" -"set type [expr {[::xotcl::is ${:type} metaclass] ? \"class\" : \"object\"}]\n" +"set type [expr {[::xotcl::objectproperty ${:type} metaclass] ? \"class\" : \"object\"}]\n" "lappend objopts type=${:type}\n" "lappend methodopts type=${:type}} else {\n" "set type ${:type}}}\n" @@ -292,14 +292,14 @@ "proc ::xotcl::parametersFromSlots {obj} {\n" "set parameterdefinitions [list]\n" "foreach slot [::xotcl2::objectInfo slotobjects $obj] {\n" -"if {[::xotcl::is $obj type ::xotcl::Object] &&\n" +"if {[::xotcl::objectproperty $obj type ::xotcl::Object] &&\n" "([$slot name] eq \"mixin\" || [$slot name] eq \"filter\")} continue\n" "array set \"\" [$slot toParameterSyntax]\n" "lappend parameterdefinitions -$(oparam)}\n" "return $parameterdefinitions}\n" "::xotcl2::Object protected method objectparameter {} {\n" "set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" -"if {[::xotcl::is [self] class]} {\n" +"if {[::xotcl::objectproperty [self] class]} {\n" "lappend parameterdefinitions -parameter:method,optional}\n" "lappend parameterdefinitions \\\n" "-noinit:method,optional,noarg \\\n" @@ -323,10 +323,10 @@ "set value ::$value}\n" "return [lsearch -all -not -glob -inline $old $value]} elseif {${:elementtype} ne \"\"} {\n" "if {[string first :: $value] == -1} {\n" -"if {![::xotcl::is $value object]} {\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" -"if {![::xotcl::is ${:elementtype} class]} {\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" "if {$p > -1} {\n" @@ -449,7 +449,7 @@ ":protected method init {} {\n" ":public method new {-childof args} {\n" "::xotcl::importvar [::xotcl::self class] {container object} withclass\n" -"if {![::xotcl::is $object object]} {\n" +"if {![::xotcl::objectproperty $object object]} {\n" "$withclass create $object}\n" "eval ::xotcl::next -childof $object $args}}}\n" "::xotcl2::Object public method contains {\n" @@ -458,16 +458,16 @@ "{-class ::xotcl2::Object}\n" "cmds} {\n" "if {![info exists object]} {set object [::xotcl::self]}\n" -"if {![::xotcl::is $object object]} {$class create $object}\n" +"if {![::xotcl::objectproperty $object object]} {$class create $object}\n" "$object requireNamespace\n" "if {$withnew} {\n" "set m [::xotcl::ScopedNew new -volatile \\\n" "-container $object -withclass $class]\n" "::xotcl2::Class mixin add $m end\n" -"if {[::xotcl::is ::xotcl::Class class]} {::xotcl::Class instmixin add $m end}\n" +"if {[::xotcl::objectproperty ::xotcl::Class class]} {::xotcl::Class instmixin add $m end}\n" "namespace eval $object $cmds\n" "::xotcl2::Class mixin delete $m\n" -"if {[::xotcl::is ::xotcl::Class class]} {::xotcl::Class instmixin delete $m}} else {\n" +"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" @@ -477,12 +477,12 @@ ":attribute objLength\n" ":method makeTargetList {t} {\n" "lappend :targetList $t\n" -"if {[::xotcl::is $t object]} {\n" +"if {[::xotcl::objectproperty $t object]} {\n" "if {[$t info hasnamespace]} {\n" "set children [$t info children]} else {\n" "return}}\n" "foreach c [namespace children $t] {\n" -"if {![::xotcl::is $c object]} {\n" +"if {![::xotcl::objectproperty $c object]} {\n" "lappend children [namespace children $t]}}\n" "foreach c $children {\n" ":makeTargetList $c}}\n" @@ -495,8 +495,8 @@ ":method copyTargets {} {\n" "foreach origin [set :targetList] {\n" "set dest [:getDest $origin]\n" -"if {[::xotcl::is $origin object]} {\n" -"if {[::xotcl::is $origin class]} {\n" +"if {[::xotcl::objectproperty $origin object]} {\n" +"if {[::xotcl::objectproperty $origin class]} {\n" "set cl [[$origin info class] create $dest -noinit]\n" "set obj $cl\n" "$cl superclass [$origin info superclass]\n" @@ -515,7 +515,7 @@ ":copyNSVarsAndCmds $origin $dest\n" "foreach i [$origin info forward] {\n" "eval [concat $dest forward $i [$origin info forward -definition $i]]}\n" -"if {[::xotcl::is $origin class]} {\n" +"if {[::xotcl::objectproperty $origin class]} {\n" "foreach i [$origin info instforward] {\n" "eval [concat $dest instforward $i [$origin info instforward -definition $i]]}}\n" "set traces [list]\n" @@ -528,7 +528,7 @@ "set def [concat $dest [lrange $def 1 end]]}\n" "$dest trace add variable $var $op $def}}}}\n" "foreach origin [set :targetList] {\n" -"if {[::xotcl::is $origin class]} {\n" +"if {[::xotcl::objectproperty $origin class]} {\n" "set dest [:getDest $origin]\n" "foreach oldslot [$origin info slots] {\n" "set newslot [::xotcl::Slot slotName [namespace tail $oldslot] $dest]\n" @@ -546,7 +546,7 @@ "if {[string trimleft $newName :] ne [string trimleft [::xotcl::self] :]} {\n" "if {$newName ne \"\"} {\n" ":copy $newName}\n" -"if {[::xotcl::is [::xotcl::self] class] && $newName ne \"\"} {\n" +"if {[::xotcl::objectproperty [::xotcl::self] 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" Index: generic/predefined.xotcl =================================================================== diff -u -r030722ec041bcc7a731eff1fdea9afa15a9b91a0 -rba41800193462bb1c6673f4774b56c9829cc991a --- generic/predefined.xotcl (.../predefined.xotcl) (revision 030722ec041bcc7a731eff1fdea9afa15a9b91a0) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision ba41800193462bb1c6673f4774b56c9829cc991a) @@ -288,7 +288,7 @@ ::xotcl::MetaSlot public method slotName {name baseObject} { # Create slot parent object if needed set slotParent ${baseObject}::slot - if {![::xotcl::is ${slotParent} object]} { + if {![::xotcl::objectproperty ${slotParent} object]} { ::xotcl2::Object create ${slotParent} } return ${slotParent}::$name @@ -338,7 +338,7 @@ # ::xotcl::MetaSlot public method new args { # set slotobject [::xotcl::self callingobject]::slot - # if {![::xotcl::is $slotobject object]} {::xotcls::Object create $slotobject} + # if {![::xotcl::objectproperty $slotobject object]} {::xotcls::Object create $slotobject} # eval next -childof $slotobject $args # } @@ -453,7 +453,7 @@ } ::xotcl::ObjectParameterSlot public method destroy {} { - if {${:domain} ne "" && [::xotcl::is ${:domain} class]} { + if {${:domain} ne "" && [::xotcl::objectproperty ${:domain} class]} { ${:domain} __invalidateobjectparameter } next @@ -467,7 +467,7 @@ if {![info exists :methodname]} { set :methodname ${:name} } - if {[::xotcl::is ${:domain} class]} { + if {[::xotcl::objectproperty ${:domain} class]} { ${:domain} __invalidateobjectparameter } if {${:per-object} && [info exists :default] } { @@ -505,7 +505,7 @@ } if {[info exists :type]} { if {[string match ::* ${:type}]} { - set type [expr {[::xotcl::is ${:type} metaclass] ? "class" : "object"}] + set type [expr {[::xotcl::objectproperty ${:type} metaclass] ? "class" : "object"}] lappend objopts type=${:type} lappend methodopts type=${:type} } else { @@ -567,7 +567,7 @@ foreach slot [::xotcl2::objectInfo slotobjects $obj] { # Skip some slots for xotcl1; # TODO: maybe different parameterFromSlots for xotcl1? - if {[::xotcl::is $obj type ::xotcl::Object] && + if {[::xotcl::objectproperty $obj type ::xotcl::Object] && ([$slot name] eq "mixin" || [$slot name] eq "filter") } continue array set "" [$slot toParameterSyntax] @@ -579,7 +579,7 @@ ::xotcl2::Object protected method objectparameter {} { #puts stderr "... objectparameter [self]" set parameterdefinitions [::xotcl::parametersFromSlots [self]] - if {[::xotcl::is [self] class]} { + if {[::xotcl::objectproperty [self] class]} { lappend parameterdefinitions -parameter:method,optional } lappend parameterdefinitions \ @@ -621,12 +621,12 @@ # value contains no globbing meta characters, but elementtype is given if {[string first :: $value] == -1} { # get fully qualified name - if {![::xotcl::is $value object]} { + if {![::xotcl::objectproperty $value object]} { error "$value does not appear to be an object" } set value [::xotcl::dispatch $value -objscope ::xotcl::self] } - if {![::xotcl::is ${:elementtype} class]} { + if {![::xotcl::objectproperty ${:elementtype} class]} { error "$value does not appear to be of type ${:elementtype}" } } @@ -868,7 +868,7 @@ :protected method init {} { :public method new {-childof args} { ::xotcl::importvar [::xotcl::self class] {container object} withclass - if {![::xotcl::is $object object]} { + if {![::xotcl::objectproperty $object object]} { $withclass create $object } eval ::xotcl::next -childof $object $args @@ -890,17 +890,17 @@ cmds } { if {![info exists object]} {set object [::xotcl::self]} - if {![::xotcl::is $object object]} {$class create $object} + if {![::xotcl::objectproperty $object object]} {$class create $object} $object requireNamespace if {$withnew} { set m [::xotcl::ScopedNew new -volatile \ -container $object -withclass $class] ::xotcl2::Class mixin add $m end # TODO: the following is not pretty; however, contains might build xotcl1 and xotcl2 objects. - if {[::xotcl::is ::xotcl::Class class]} {::xotcl::Class instmixin add $m end} + if {[::xotcl::objectproperty ::xotcl::Class class]} {::xotcl::Class instmixin add $m end} namespace eval $object $cmds ::xotcl2::Class mixin delete $m - if {[::xotcl::is ::xotcl::Class class]} {::xotcl::Class instmixin delete $m} + if {[::xotcl::objectproperty ::xotcl::Class class]} {::xotcl::Class instmixin delete $m} } else { namespace eval $object $cmds } @@ -921,7 +921,7 @@ :method makeTargetList {t} { lappend :targetList $t # if it is an object without namespace, it is a leaf - if {[::xotcl::is $t object]} { + if {[::xotcl::objectproperty $t object]} { if {[$t info hasnamespace]} { # make target list from all children set children [$t info children] @@ -933,7 +933,7 @@ # now append all namespaces that are in the obj, but that # are not objects foreach c [namespace children $t] { - if {![::xotcl::is $c object]} { + if {![::xotcl::objectproperty $c object]} { lappend children [namespace children $t] } } @@ -961,9 +961,9 @@ #puts stderr "COPY will copy targetList = [set :targetList]" foreach origin [set :targetList] { set dest [:getDest $origin] - if {[::xotcl::is $origin object]} { + if {[::xotcl::objectproperty $origin object]} { # copy class information - if {[::xotcl::is $origin class]} { + if {[::xotcl::objectproperty $origin class]} { set cl [[$origin info class] create $dest -noinit] # class object set obj $cl @@ -991,7 +991,7 @@ foreach i [$origin info forward] { eval [concat $dest forward $i [$origin info forward -definition $i]] } - if {[::xotcl::is $origin class]} { + if {[::xotcl::objectproperty $origin class]} { foreach i [$origin info instforward] { eval [concat $dest instforward $i [$origin info instforward -definition $i]] } @@ -1014,7 +1014,7 @@ } # alter 'domain' and 'manager' in slot objects for classes foreach origin [set :targetList] { - if {[::xotcl::is $origin class]} { + if {[::xotcl::objectproperty $origin class]} { set dest [:getDest $origin] foreach oldslot [$origin info slots] { set newslot [::xotcl::Slot slotName [namespace tail $oldslot] $dest] @@ -1047,7 +1047,7 @@ :copy $newName } ### let all subclasses get the copied class as superclass - if {[::xotcl::is [::xotcl::self] class] && $newName ne ""} { + if {[::xotcl::objectproperty [::xotcl::self] class] && $newName ne ""} { foreach subclass [:info subclass] { set scl [$subclass info superclass] if {[set index [lsearch -exact $scl [::xotcl::self]]] != -1} {