Index: generic/predefined.xotcl =================================================================== diff -u -r670151ba40e8da27625ed679f2d3ff58d1763239 -r4a91216d0624226fb9a64de97feccc84cc79df79 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 670151ba40e8da27625ed679f2d3ff58d1763239) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 4a91216d0624226fb9a64de97feccc84cc79df79) @@ -476,6 +476,7 @@ } ${:domain} __invalidateobjectparameter set cl [expr {${:per-object} ? "Object" : "Class"}] + #puts stderr "Slot [self] init, forwarder on ${:domain}" ::xotcl::forward ${:domain} ${:name} \ ${:manager} \ [list %1 [${:manager} defaultmethods]] %self \ @@ -851,6 +852,12 @@ # register the optimizer per default ::xotcl::Attribute mixin add ::xotcl::Attribute::Optimizer + ############################################ + # Define method "attribute" for convenience + ############################################ + ::xotcl2::Object method attribute {spec {-slotclass ::xotcl::Attribute} {initblock ""}} { + $slotclass createFromParameterSyntax [self] -initblock $initblock {*}$spec + } ############################################ # Define method "parameter" for backward @@ -906,17 +913,19 @@ # (without syntactic overhead). ################################################################## -::xotcl2::Class create ::xotcl::ScopedNew -superclass ::xotcl2::Class -parameter { - {withclass ::xotcl2::Object} - container -} -::xotcl::ScopedNew protected method init {} { - :public method new {-childof args} { - ::xotcl::importvar [::xotcl::self class] {container object} withclass - if {![::xotcl::is $object object]} { - $withclass create $object +::xotcl2::Class create ::xotcl::ScopedNew -superclass ::xotcl2::Class { + + :attribute {withclass ::xotcl2::Object} + :attribute container + + :protected method init {} { + :public method new {-childof args} { + ::xotcl::importvar [::xotcl::self class] {container object} withclass + if {![::xotcl::is $object object]} { + $withclass create $object + } + eval ::xotcl::next -childof $object $args } - eval ::xotcl::next -childof $object $args } } @@ -956,12 +965,12 @@ # copy/move implementation ################################################################## -::xotcl2::Class create ::xotcl::CopyHandler -parameter { - {targetList ""} - {dest ""} - objLength -} { +::xotcl2::Class create ::xotcl::CopyHandler { + :attribute {targetList ""} + :attribute {dest ""} + :attribute objLength + :method makeTargetList {t} { lappend :targetList $t # if it is an object without namespace, it is a leaf