Index: tests/parameters.test =================================================================== diff -u -rf9a705afeb75b5fb944821b3d3da27d969941293 -rf858f142f5fab4f88996b3eb709c3afa55114be9 --- tests/parameters.test (.../parameters.test) (revision f9a705afeb75b5fb944821b3d3da27d969941293) +++ tests/parameters.test (.../parameters.test) (revision f858f142f5fab4f88996b3eb709c3afa55114be9) @@ -1,6 +1,7 @@ # -*- Tcl -*- package require nx package require nx::test + #::nx::configure defaultMethodCallProtection false nx::Test case dummy { @@ -43,7 +44,7 @@ } C create c1 nx::Class create M - c1 mixin M + c1 object mixin M ? {::nsf::object::exists o1} 1 ? {::nsf::object::exists o1000} 0 @@ -148,17 +149,17 @@ nx::Test parameter count 10 nx::Test case multiple-method-checkers { nx::Object create o { - :public method foo {} { + :public object method foo {} { ::nsf::is metaclass ::XYZ ::nsf::is metaclass ::nx::Object } - :public method bar {} { + :public object method bar {} { ::nsf::is metaclass ::XYZ ::nsf::is metaclass ::XYZ } - :public method bar2 {} { + :public object method bar2 {} { ::nsf::is metaclass ::nx::Object ::nsf::is metaclass ::nx::Object } @@ -181,7 +182,7 @@ nx::Test case param-manager { nx::Object create ::paramManager { - :method type=sex {name value} { + :object method type=sex {name value} { return "agamous" } } @@ -274,7 +275,7 @@ C create c1 ? {C eval :__objectparameter} \ - "{-superclass:class,alias,method=::nsf::methods::class::superclass,1..n ::nx::Object} -object-mixin:mixinreg,alias,method=::nsf::classes::nx::Object::mixin -mixin:mixinreg,alias,0..n -object-filter:filterreg,alias,method=::nsf::classes::nx::Object::filter -filter:filterreg,alias,0..n -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -class:class,alias,method=::nsf::methods::object::class __initcmd:initcmd,optional,noleadingdash" + "{-superclass:class,alias,method=::nsf::methods::class::superclass,1..n ::nx::Object} -mixin:mixinreg,alias,1..n -filter:filterreg,alias,1..n -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" #### TOOD: remove or add #? {c1 eval :__objectparameter} \ @@ -306,7 +307,7 @@ "::D::slot::d ::C::slot::a ::C::slot::b ::C::slot::c" ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" } ####################################################### @@ -335,29 +336,29 @@ D mixin M ? {d1 eval :__objectparameter} \ - "-b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" \ + "-b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" \ "mixin added" M mixin M2 ? {d1 eval :__objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" \ + "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" \ "transitive mixin added" D mixin "" #we should have again the old interface ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" C mixin M ? {d1 eval :__objectparameter} \ - "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" \ + "-b2 -b -m1 -m2 -d:required -a {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" \ "mixin added" C mixin "" #we should have again the old interface ? {d1 eval :__objectparameter} \ - "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + "-d:required -a -b:boolean {-c 1} -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" } ####################################################### @@ -379,7 +380,7 @@ ? {D create d1} \ {required argument 'd' is missing, should be: - ::d1 __configure -d value ?-a value? ?-b boolean? ?-c value? ?-volatile? ?-noinit? ?-mixin mixinreg ...? ?-class class? ?-filter filterreg ...? ?__initcmd?} + ::d1 __configure -d value ?-a value? ?-b boolean? ?-c value? ?-volatile? ?-noinit? ?-object-mixin mixinreg ...? ?-class class? ?-object-filter filterreg ...? ?__initcmd?} ? {D create d2 -d x -b a} \ {expected boolean but got "a" for parameter "-b"} \ @@ -643,7 +644,7 @@ # Create a user-defined value checker for method parameters, # without extra argument - ::nx::methodParameterSlot method type=mytype {name value} { + ::nx::methodParameterSlot object method type=mytype {name value} { if {$value < 1 || $value > 3} { error "value '$value' of parameter $name is not between 1 and 3" } @@ -670,7 +671,7 @@ # Create a user-defined value-checker for method parameters, # with a extra argument # - ::nx::methodParameterSlot method type=in {name value arg} { + ::nx::methodParameterSlot object method type=in {name value arg} { if {$value ni [split $arg |]} { error "value '$value' of parameter $name not in permissible values $arg" } @@ -708,7 +709,7 @@ # Create a user-defined value checker for method parameters, # without extra argument # - ::nx::methodParameterSlot method type=commaRange {name value arg} { + ::nx::methodParameterSlot object method type=commaRange {name value arg} { lassign [split $arg ,] min max if {$value < $min || $value > $max} { error "value '$value' of parameter $name not between $min and $max" @@ -740,7 +741,7 @@ # # Classical range check # - ::nx::methodParameterSlot method type=range {name value arg} { + ::nx::methodParameterSlot object method type=range {name value arg} { lassign [split $arg -] min max if {$value < $min || $value > $max} { error "value '$value' of parameter $name not between $min and $max" @@ -765,7 +766,7 @@ # # handling of arg with spaces/arg as list # - ::nx::methodParameterSlot public method type=list {name value arg} { + ::nx::methodParameterSlot public object method type=list {name value arg} { #puts $value/$arg return $value } @@ -789,30 +790,30 @@ nx::Class create M nx::Class create M2 D create d1 -d 1 - C create c1 -mixin M - C create c2 -mixin {{M -guard true}} - C create c3 -mixin {M ::M2} - C create c4 -mixin {{M -guard 1} M2} - C create c5 -mixin {M {M2 -guard 2}} + C create c1 -object-mixin M + C create c2 -object-mixin {{M -guard true}} + C create c3 -object-mixin {M ::M2} + C create c4 -object-mixin {{M -guard 1} M2} + C create c5 -object-mixin {M {M2 -guard 2}} nx::Object create o - ? {c1 info mixin classes} ::M - ? {c1 info mixin guard ::M} "" + ? {c1 info object mixin classes} ::M + ? {c1 info object mixin guard ::M} "" - ? {c2 info mixin classes} ::M - ? {c2 info mixin guard ::M} "true" + ? {c2 info object mixin classes} ::M + ? {c2 info object mixin guard ::M} "true" - ? {c3 info mixin classes} {::M ::M2} - ? {c3 info mixin guard M} "" - ? {c3 info mixin guard M2} "" + ? {c3 info object mixin classes} {::M ::M2} + ? {c3 info object mixin guard M} "" + ? {c3 info object mixin guard M2} "" - ? {c4 info mixin classes} {::M ::M2} - ? {c4 info mixin guard M} "1" - ? {c4 info mixin guard M2} "" + ? {c4 info object mixin classes} {::M ::M2} + ? {c4 info object mixin guard M} "1" + ? {c4 info object mixin guard M2} "" - ? {c5 info mixin classes} {::M ::M2} - ? {c5 info mixin guard M} "" - ? {c5 info mixin guard M2} "2" + ? {c5 info object mixin classes} {::M ::M2} + ? {c5 info object mixin guard M} "" + ? {c5 info object mixin guard M2} "2" D public method foo-base {x:baseclass} {return $x} D public method foo-class {x:class} {return $x} @@ -864,23 +865,23 @@ :property {z {1 2 3}} } S create s1 { - :public method foo {{y:substdefault ${:x}}} { + :public object method foo {{y:substdefault ${:x}}} { return $y } - :public method bar {{y:integer,substdefault ${:x}}} { + :public object method bar {{y:integer,substdefault ${:x}}} { return $y } - :public method baz {{x:integer,substdefault ${:y}}} { + :public object method baz {{x:integer,substdefault ${:y}}} { return $x } - :public method boz {{x:integer,0..n,substdefault ${:z}}} { + :public object method boz {{x:integer,0..n,substdefault ${:z}}} { return $x } } ? {s1 foo} 1 ? {s1 foo 2} 2 - ? {S method foo {a:substdefault} {return 1}} \ + ? {S object method foo {a:substdefault} {return 1}} \ {parameter option substdefault specified for parameter "a" without default value} ? {s1 bar} 1 @@ -899,16 +900,16 @@ ? {s1 boz {100 200}} {100 200} set ::aaa 100 - ? {s1 public method foo {{a:substdefault $::aaa}} {return $a}} ::s1::foo + ? {s1 public object method foo {{a:substdefault $::aaa}} {return $a}} ::s1::foo ? {s1 foo} 100 unset ::aaa ? {s1 foo} {can't read "::aaa": no such variable} - ? {s1 public method foo {{a:substdefault $aaa}} {return $a}} ::s1::foo + ? {s1 public object method foo {{a:substdefault $aaa}} {return $a}} ::s1::foo ? {s1 foo} {can't read "aaa": no such variable} - ? {s1 public method foo {{a:substdefault [current]}} {return $a}} ::s1::foo + ? {s1 public object method foo {{a:substdefault [current]}} {return $a}} ::s1::foo ? {s1 foo} ::s1 } @@ -975,7 +976,7 @@ MC create MC1 nx::Class create M D create d1 -d 1 - C create c1 -mixin M + C create c1 -object-mixin M nx::Object create o nx::Class create ParamTest { @@ -1083,7 +1084,7 @@ ####################################################### nx::Test case multivalued-app-converter { - ::nx::methodParameterSlot public method type=sex {name value args} { + ::nx::methodParameterSlot public object method type=sex {name value args} { #puts stderr "[current] slot specific converter" switch -glob $value { m* {return m} @@ -1100,7 +1101,7 @@ ? {c1 bar {male female mann frau}} "male female mann frau" nx::Object create tmpObj - tmpObj method type=mType {name value arg:optional} { + tmpObj object method type=mType {name value arg:optional} { if {$value} { error "expected false but got $value" } @@ -1121,12 +1122,12 @@ nx::Test case shadowing-app-converter { nx::Object create mySlot { - :public method type=integer {name value arg:optional} { + :public object method type=integer {name value arg:optional} { return [expr {$value + 1}] } } nx::Object create o { - :public method foo {x:integer,slot=::mySlot,convert} { + :public object method foo {x:integer,slot=::mySlot,convert} { return $x } } @@ -1146,7 +1147,7 @@ nx::Object create o3 nx::Object create o { - :public method foo {x:integer,0..1 y:integer os:object,0..*} { + :public object method foo {x:integer,0..1 y:integer os:object,0..*} { return $x } } @@ -1156,9 +1157,9 @@ ? {o foo 1 "" {o1 o2}} {expected integer but got "" for parameter "y"} "second is empty" ? {o foo 1 2 {}} 1 "empty list" - ? {o info method parameter foo} "x:integer,0..1 y:integer os:object,0..*" + ? {o info object method parameter foo} "x:integer,0..1 y:integer os:object,0..*" - o public method foo {x:integer,0..1 y:integer os:object,1..*} {return $x} + o public object method foo {x:integer,0..1 y:integer os:object,1..*} {return $x} ? {o foo 1 2 {o1 "" o2}} {invalid value in "o1 "" o2": expected object but got "" for parameter "os"} \ "list contains empty value" ? {o foo "" 2 {}} {invalid value for parameter 'os': list is not allowed to be empty} \ @@ -1173,7 +1174,7 @@ :property sex { :type "sex" :convert true - :method type=sex {name value} { + :object method type=sex {name value} { #puts stderr "[self] slot specific converter" switch -glob $value { m* {return m} @@ -1201,25 +1202,25 @@ ? {::nsf::method::setter ::o :a} {invalid setter name ":a" (must not start with a dash or colon)} ? {::nsf::method::setter o a} "::o::a" ? {::nsf::method::setter C c} "::nsf::classes::C::c" - ? {o info method definition a} "::o public setter a" - ? {o info method parameter a} "a" - ? {o info method args a} "a" + ? {o info object method definition a} "::o public object setter a" + ? {o info object method parameter a} "a" + ? {o info object method args a} "a" ? {C info method definition c} "::C public setter c" ? {o a 1} "1" ? {::nsf::method::setter o a:integer} "::o::a" ? {::nsf::method::setter o ints:integer,1..*} "::o::ints" ? {::nsf::method::setter o o:object} "::o::o" - ? {o info method registrationhandle ints} "::o::ints" - ? {o info method definition ints} "::o public setter ints:integer,1..*" - ? {o info method parameter ints} "ints:integer,1..*" - ? {o info method args ints} "ints" + ? {o info object method registrationhandle ints} "::o::ints" + ? {o info object method definition ints} "::o public object setter ints:integer,1..*" + ? {o info object method parameter ints} "ints:integer,1..*" + ? {o info object method args ints} "ints" - ? {o info method registrationhandle o} "::o::o" - ? {o info method definition o} "::o public setter o:object" - ? {o info method parameter o} "o:object" - ? {o info method args o} "o" + ? {o info object method registrationhandle o} "::o::o" + ? {o info object method definition o} "::o public object setter o:object" + ? {o info object method parameter o} "o:object" + ? {o info object method args o} "o" ? {o a 2} 2 ? {o a hugo} {expected integer but got "hugo" for parameter "a"} @@ -1512,13 +1513,13 @@ nx::Test case checktype { nx::Object create o { - :public method f01 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype ::nx::Object} - :public method f02 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype nx::Object} - :public method f03 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype nx::Object} + :public object method f01 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype ::nx::Object} + :public object method f02 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype nx::Object} + :public object method f03 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype nx::Object} - :public method f11 {} {::nsf::is object,type=::nx::Object o} - :public method f12 {} {::nsf::is object,type=nx::Object o} - :public method f13 {} {::nsf::is object,type=Object o} + :public object method f11 {} {::nsf::is object,type=::nx::Object o} + :public object method f12 {} {::nsf::is object,type=nx::Object o} + :public object method f13 {} {::nsf::is object,type=Object o} } ? {o f01} 1 @@ -1543,17 +1544,17 @@ } nx::Object create o { - :public method f01 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype ::nx::Object} - :public method f02 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} - :public method f03 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} - :public method f04 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype foo::C} - :public method f05 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} + :public object method f01 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype ::nx::Object} + :public object method f02 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} + :public object method f03 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} + :public object method f04 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype foo::C} + :public object method f05 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} - :public method f11 {} {::nsf::is object,type=::nx::Object c1} - :public method f12 {} {::nsf::is object,type=nx::Object c1} - :public method f13 {} {::nsf::is object,type=Object c1} - :public method f14 {} {::nsf::is object,type=foo::C c1} - :public method f15 {} {::nsf::is object,type=C c1} + :public object method f11 {} {::nsf::is object,type=::nx::Object c1} + :public object method f12 {} {::nsf::is object,type=nx::Object c1} + :public object method f13 {} {::nsf::is object,type=Object c1} + :public object method f14 {} {::nsf::is object,type=foo::C c1} + :public object method f15 {} {::nsf::is object,type=C c1} } ? {o f01} 1 @@ -1843,13 +1844,13 @@ nx::Class create M1 {:property b1:required} nx::Class create M2 {:property b2:required} - ? {c1 eval :__objectparameter} "-a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" - c1 mixin M1 + c1 object mixin M1 ? {c1 info precedence} "::M1 ::C ::nx::Object" - ? {c1 eval :__objectparameter} "-b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" # # Invalidate the object parameter and expect that the per-class @@ -1886,32 +1887,32 @@ # we have now per-object mixin of M1, we should have "-b1" but no # "-b2" # - ? {c1 info mixin classes} ::M1 - ? {c1 cget -mixin} ::M1 + ? {c1 info object mixin classes} ::M1 + ? {c1 cget -object-mixin} ::M1 ? {c1 info lookup parameter names b*} "b1" # # add one more mixin. # - c1 mixin add ::M2 - ? {c1 info mixin classes} {::M2 ::M1} - ? {c1 cget -mixin} {::M2 ::M1} + c1 object mixin add ::M2 + ? {c1 info object mixin classes} {::M2 ::M1} + ? {c1 cget -object-mixin} {::M2 ::M1} ? {c1 info lookup parameter syntax b1} "-b1 value" ? {c1 info lookup parameter syntax b2} "-b2 value" ? {lsort [c1 info lookup parameter names b*]} "b1 b2" # # drop the mixins, the b* properties should be gone. # - c1 mixin "" - ? {c1 info mixin classes} {} + c1 object mixin "" + ? {c1 info object mixin classes} {} ? {lsort [c1 info lookup parameter names b*]} "" # # add M1 again # - c1 mixin add ::M1 - ? {c1 info mixin classes} {::M1} + c1 object mixin add ::M1 + ? {c1 info object mixin classes} {::M1} ? {c1 info lookup parameter syntax b1} "-b1 value" ? {lsort [c1 info lookup parameter names b*]} "b1" # @@ -1944,13 +1945,13 @@ nx::Class create D -superclass C nx::Class create M {:property b1:required} - c1 mixin M + c1 object mixin M ? {c1 info precedence} "::M ::C ::nx::Object" - ? {C info slot objects -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::filter" + ? {C info slot objects -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::object-mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::object-filter" - ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" # # invalidate object parameter and expect that the per-class mixin @@ -1962,9 +1963,9 @@ ? {c1 info precedence} "::M ::C ::nx::Object" - ? {C info slot objects -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::filter" + ? {C info slot objects -closure} "::C::slot::a1 ::nx::Object::slot::volatile ::nx::Object::slot::noinit ::nx::Object::slot::object-mixin ::nx::Object::slot::__initcmd ::nx::Object::slot::class ::nx::Object::slot::object-filter" - ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -mixin:mixinreg,alias,0..n -class:class,alias,method=::nsf::methods::object::class -filter:filterreg,alias,0..n __initcmd:initcmd,optional,noleadingdash" + ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 -volatile:alias,slot=::nx::Object::slot::volatile,slotassign,noarg -noinit:alias,method=::nsf::methods::object::noinit,noarg -object-mixin:mixinreg,alias,method=::nx::Object::slot::__object::mixin,1..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,alias,method=::nx::Object::slot::__object::filter,1..n __initcmd:initcmd,optional,noleadingdash" # should not require b1 ? {C create c2} ::c2 @@ -1980,10 +1981,10 @@ nx::Test case bignums { ::nx::Object create o { - :public method foo {x:int} { return $x } - :public method foo32 {x:int32} { return $x } - :public method bar {x:wideinteger} { return $x } - :public method baz {x:double} { return $x } + :public object method foo {x:int} { return $x } + :public object method foo32 {x:int32} { return $x } + :public object method bar {x:wideinteger} { return $x } + :public object method baz {x:double} { return $x } } # @@ -2218,16 +2219,16 @@ nx::Class create C { # set 2 class variables, one via variable, one via property - ? [list [self] class variable -nocomplain v "v0"] "" - ? [list [self] class property -nocomplain [list a "a0"]] "::C::a" + ? [list [self] object variable -nocomplain v "v0"] "" + ? [list [self] object property -nocomplain [list a "a0"]] "::C::a" # in both cases, we expect instance variables ? [list [self] eval {set :v}] "v0" ? [list [self] eval {set :a}] "a0" # check variable with value constraint - ? [list [self] class variable -nocomplain x:int "0"] "" - ? [list [self] class variable -nocomplain y:int "a0"] {expected integer but got "a0"} + ? [list [self] object variable -nocomplain x:int "0"] "" + ? [list [self] object variable -nocomplain y:int "a0"] {expected integer but got "a0"} } } @@ -2267,8 +2268,8 @@ ? {C create c2 -a 10} ::c2 ? {C create c2 -v 10} \ - {invalid non-positional argument '-v', valid are : -a, -volatile, -noinit, -mixin, -class, -filter; - should be "::c2 configure ?-a value? ?-volatile? ?-noinit? ?-mixin mixinreg ...? ?-class class? ?-filter filterreg ...? ?__initcmd?"} + {invalid non-positional argument '-v', valid are : -a, -volatile, -noinit, -object-mixin, -class, -object-filter; + should be "::c2 configure ?-a value? ?-volatile? ?-noinit? ?-object-mixin mixinreg ...? ?-class class? ?-object-filter filterreg ...? ?__initcmd?"} # # We expect a setter for "a" but not for "v". @@ -2436,8 +2437,8 @@ } # "v" does NOT show up in "info parameter" - ? {C info parameter list} "-volatile -noinit -mixin -class -filter __initcmd" - ? {C info parameter names} "volatile noinit mixin class filter __initcmd" + ? {C info parameter list} "-volatile -noinit -object-mixin -class -object-filter __initcmd" + ? {C info parameter names} "volatile noinit object-mixin class object-filter __initcmd" # "v" does show up in "info slot ..." ? {C info slot objects} "::C::slot::v" @@ -2451,8 +2452,8 @@ } # "p2" and "p3" do NOT show up in "info parameter" - ? {D info parameter list} "-p0 -p1 -volatile -noinit -mixin -class -filter __initcmd" - ? {D info parameter names} "p0 p1 volatile noinit mixin class filter __initcmd" + ? {D info parameter list} "-p0 -p1 -volatile -noinit -object-mixin -class -object-filter __initcmd" + ? {D info parameter names} "p0 p1 volatile noinit object-mixin class object-filter __initcmd" # "p1" and "p2" do NOT show up in "info methods" ? {D info methods} "p0 p3" @@ -2490,7 +2491,7 @@ } # "p1" and "p2" do NOT show up in "info methods" - ? {o2 info methods} "p0 p3" + ? {o2 info object methods} "p0 p3" # all properties with slots show up in "info slot" ? {o2 info slot objects} "::o2::per-object-slot::p0 ::o2::per-object-slot::p1 ::o2::per-object-slot::p3" @@ -2550,7 +2551,7 @@ nx::Test case side-effect-set-value { nx::Class create C { - :public class method setObjectParams {spec} { + :public object method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [self] } @@ -2588,7 +2589,7 @@ set ::slotcalls 0 nx::Class create Foo { :property bar { - :public method assign { object property value } { + :public object method assign { object property value } { incr ::slotcalls 1 nsf::var::set $object $property $value } @@ -2612,7 +2613,7 @@ set ::slotcalls 0 nx::Class create Foo { :property {baz 1} { - :public method assign { object property value } { + :public object method assign { object property value } { incr ::slotcalls 1 nsf::var::set $object $property $value } @@ -2644,7 +2645,7 @@ ? {nx::Class create Foo { :property -accessor none bar { - :public method assign { object property value } { + :public object method assign { object property value } { incr ::slotcalls 1 nsf::var::set $object $property $value } @@ -2658,7 +2659,7 @@ # test cases for default nx::Class create Foo { :property -accessor none {baz 1} { - :public method assign { object property value } { + :public object method assign { object property value } { incr ::slotcalls 1 nsf::var::set $object $property $value } @@ -2684,7 +2685,7 @@ ? {nx::Class create Foo { :property bar { - :public method initialize { object property } { + :public object method initialize { object property } { incr ::slotcalls 1 } }} @@ -2706,10 +2707,10 @@ nx::Class create Test2 { :property list { - :public method assign { obj var val } { + :public object method assign { obj var val } { nsf::var::set $obj $var [list $obj $var $val] } - :method unknown { val obj var args } { + :object method unknown { val obj var args } { return unknown } } @@ -2735,7 +2736,7 @@ ? {objekt eval {info exists :a}} 0 ? {catch { objekt variable -accessor public -initblock { - :public method assign args { + :public object method assign args { incr :assignCalled next }