Index: TODO =================================================================== diff -u -r429233815fd3d539ad62c2ae366b515eb0b069d2 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- TODO (.../TODO) (revision 429233815fd3d539ad62c2ae366b515eb0b069d2) +++ TODO (.../TODO) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -5233,9 +5233,55 @@ - replace deprecated function mongoc_collection_delete by mongoc_collection_remove - tested with MongoDB v2.6.1 +nx.tcl: +- removed + /cls/ info configure parameters + /cls/ info configure + /cls/ info syntax + Use e.g. "/cls/ info lookup parameters create" instead + +nsf.c: +- Let "/cls/ info mixinof -closure" return as well implicit mixin classes + to make it easier to determine class dependencies. + + Example: + + nx::Class create M0 + nx::Class create M1 -superclass M0 + nx::Class create M2 -superclass M1 + + nx::Class create C + nx::Class create D -superclass C + + C mixin add M2 + + # M2 is mixed into C, and implicitely into D + # + # Since M2 is a subclass of M1, classes C and D depend as well + # on M1 and M0, as seen in the heritage: + + ? {C info heritage} ":M2 ::M1 ::M0 ::nx::Object" + ? {D info heritage} ":M2 ::M1 ::M0 ::C ::nx::Object" + + # previously, only "M2 info mixinof -closure" showed the + # mixin relations, even with "-closure", while M1 and M0 did not. + + ? {M2 info mixinof -closure} "::C ::D" + + # now these show the same relations (in this example). + + ? {M1 info mixinof -closure} "::C ::D" + ? {M0 info mixinof -closure} "::C ::D" + +- adapt mixinof.test to the additional information +- transform mixinof.test to newer style regression test with autoated object deletion + ======================================================================== TODO: - update migration guide/tutorial + +- should we change "/obj/ info lookup syntax" to return obj and method as well? + - use context-object for error messages of configure/new/create/recreate - remove // comments @@ -5273,7 +5319,7 @@ p1 info lookup syntax configure (short form of nsf::method::get syntax [p1 info lookup method configure]) - where "configure is a method name", would work the same way as "p1 info lookup syntax create|foo|..." + where "configure" is a method name, would work the same way as "p1 info lookup syntax create|foo|..." (under the assumption, we get the "right" syntax for configure). Similar: Index: tests/class-method.test =================================================================== diff -u -r0e4ebdb092c8158987489b5c26cf11526b2756f5 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/class-method.test (.../class-method.test) (revision 0e4ebdb092c8158987489b5c26cf11526b2756f5) +++ tests/class-method.test (.../class-method.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -17,7 +17,7 @@ ? {lsort [::C info object methods]} "f" ? {lsort [::C info]} \ - "valid submethods of ::C info: children class configure filter has heritage info instances lookup method methods mixin mixinof name object parent precedence slots subclass superclass variable variables vars" + "valid submethods of ::C info: children class filter has heritage info instances lookup method methods mixin mixinof name object parent precedence slots subclass superclass variable variables vars" } # @@ -76,7 +76,7 @@ ? {lsort [::C info object methods]} "a f foo fwd p v2" ? {lsort [::C info]} \ - "valid submethods of ::C info: children class configure filter has heritage info instances lookup method methods mixin mixinof name object parent precedence slots subclass superclass variable variables vars" + "valid submethods of ::C info: children class filter has heritage info instances lookup method methods mixin mixinof name object parent precedence slots subclass superclass variable variables vars" } # Index: tests/info-method.test =================================================================== diff -u -ra093703e9836fc152fcbbce96d4f880ace6a6170 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/info-method.test (.../info-method.test) (revision a093703e9836fc152fcbbce96d4f880ace6a6170) +++ tests/info-method.test (.../info-method.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -718,17 +718,17 @@ } C new - ? {C info configure syntax} "/::C/ ?-a /value/? ?-b /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" -# ? {C info configure syntax a} "/::C/ ?-a /value/?" + ? {C info lookup syntax create} "/objectName/ ?-a /value/? ?-b /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + ? {C info lookup syntax create a} "?-a /value/?" - ? {C info configure parameters } "-a {-b 1} -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" + ? {C info lookup parameters create } "objectName -a {-b 1} -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" -# ? {C info parameter list} "-a -b -noinit -object-mixin -class -object-filter __initblock" -# ? {C info parameter names} "a b noinit object-mixin class object-filter __initblock" + #? {C info parameter list} "-a -b -noinit -object-mixin -class -object-filter __initblock" + #? {C info lookup args create} "methodName a b noinit object-mixin class object-filter __initblock" ? {lsort [C info slots -closure]} "::C::slot::a ::C::slot::b ::nx::Object::slot::__initblock ::nx::Object::slot::class ::nx::Object::slot::object-filter ::nx::Object::slot::object-mixin" - ? {C info configure parameters b} "{-b 1}" - ? {D info configure parameters b} "{-b 2}" + ? {C info lookup parameters create b} "{-b 1}" + ? {D info lookup parameters create b} "{-b 2}" ? {D info slots -closure b} "::D::slot::b" ? {D info slots -closure a} "::C::slot::a" ? {D info slots -closure class} "::nx::Object::slot::class" Index: tests/info-variable.test =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/info-variable.test (.../info-variable.test) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ tests/info-variable.test (.../info-variable.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -30,17 +30,18 @@ :public method foo {-force:switch age:integer {name ""}} {return $age} } - ? {join [Person info configure parameters] \n} \ -"-age:integer + ? {join [Person info lookup parameters create] \n} \ +"objectName +-age:integer -name -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" - ? {Person info configure parameters age} "-age:integer" - ? {Person info configure parameters {*a[gs]*}} "-age:integer -class:class,alias,method=::nsf::methods::object::class" - ? {Person info configure syntax} "/::Person/ ?-age /integer/? ?-name /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + ? {Person info lookup parameters create age} "-age:integer" + ? {Person info lookup parameters create {*a[gs]*}} "-age:integer -class:class,alias,method=::nsf::methods::object::class" + ? {Person info lookup syntax create} "/objectName/ ?-age /integer/? ?-name /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" ? {Person info method parameters foo} {-force:switch age:integer {name ""}} ? {Person info method parameters foo force} "-force:switch" @@ -55,7 +56,7 @@ ? {nsf::parameter::info name "a b"} "a" - ? {lmap p [Person info configure parameters] {nsf::parameter::info default $p}} "0 0 0 0 0 0" + ? {lmap p [Person info lookup parameters create] {nsf::parameter::info default $p}} "0 0 0 0 0 0 0" ? {lmap p [Person info method parameters foo] {nsf::parameter::info default $p}} "1 0 1" nx::Class create Bar { @@ -74,12 +75,12 @@ :create f1 } - ? {lmap p [Foo info configure parameters] {nsf::parameter::info name $p}} \ - "i a b p object-mixin class object-filter __initblock" - ? {lmap p [Foo info configure parameters] {nsf::parameter::info default $p}} \ - "0 0 1 1 0 0 0 0" - ? {lmap p [Foo info configure parameters] {nsf::parameter::info type $p}} \ - "{} integer integer {} mixinreg class filterreg {}" + ? {lmap p [Foo info lookup parameters create] {nsf::parameter::info name $p}} \ + "objectName i a b p object-mixin class object-filter __initblock" + ? {lmap p [Foo info lookup parameters create] {nsf::parameter::info default $p}} \ + "0 0 0 1 1 0 0 0 0" + ? {lmap p [Foo info lookup parameters create] {nsf::parameter::info type $p}} \ + "{} {} integer integer {} mixinreg class filterreg {}" ? {join [lsort [::Foo info slots]] \n} \ "::Foo::slot::____Foo.p @@ -91,7 +92,7 @@ ::Foo::slot::i ::Foo::slot::q" - ? {::Foo info configure parameters ?} "-i:1..n -a:integer {-b:integer 123} {-p 9}" + ? {::Foo info lookup parameters create ?} "-i:1..n -a:integer {-b:integer 123} {-p 9}" ? {::Foo::slot::b definition} "::Foo property -accessor none {b:integer 123}" ? {::Foo::slot::i definition} "::Foo property -accessor public -incremental i:1..n" ? {::Foo::slot::____Foo.p definition} "::Foo variable -accessor private p 19" Index: tests/nsf-cmd.test =================================================================== diff -u --- tests/nsf-cmd.test (revision 0) +++ tests/nsf-cmd.test (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -0,0 +1,286 @@ +package require nx::test + + +nx::test case nsf-method-get-variants { + + # + # Create a simple class + # + nx::Class create Person { + :property name + :public method foo {x:integer} {return foo-$x} + :public method "string match" {pattern string} {return string-match-$string} + :create p1 + } + + # + # A plain method + # + set ::handle [p1 info lookup method foo] + + ? {nsf::cmd::info args $::handle} x + ? {nsf::cmd::info body $::handle} {return foo-$x} + ? {nsf::cmd::info definition $::handle} {::Person public method foo x:integer {return foo-$x}} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} ::nsf::classes::Person::foo + ? {nsf::cmd::info definitionhandle $::handle} ::nsf::classes::Person::foo + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} x:integer + ? {nsf::cmd::info syntax $::handle} "/x/" + ? {nsf::cmd::info type $::handle} scripted + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # An ensemble method + # + set ::handle [p1 info lookup method "string match"] + + ? {nsf::cmd::info args $::handle} "pattern string" + ? {nsf::cmd::info body $::handle} {return string-match-$string} + ? {nsf::cmd::info definition $::handle} {::Person public method {string match} {pattern string} {return string-match-$string}} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} "::nsf::classes::Person::string match" + ? {nsf::cmd::info definitionhandle $::handle} "::Person::slot::__string::match" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "pattern string" + ? {nsf::cmd::info syntax $::handle} "/pattern/ /string/" + ? {nsf::cmd::info type $::handle} scripted + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # An C-defined method inherited from nx::Object + # + set ::handle [p1 info lookup method configure] + + ? {nsf::cmd::info args $::handle} args + ? {nsf::cmd::info body $::handle} "" + ? {nsf::cmd::info definition $::handle} "::nx::Object public alias configure ::nsf::methods::object::configure" + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} ::nsf::classes::nx::Object::configure + ? {nsf::cmd::info definitionhandle $::handle} ::nsf::classes::nx::Object::configure + ? {nsf::cmd::info origin $::handle} ::nsf::methods::object::configure + ? {nsf::cmd::info parameter $::handle} args:virtualobjectargs + ? {nsf::cmd::info syntax $::handle} "?/arg .../?" + ? {nsf::cmd::info type $::handle} alias + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # An undefined method + # + set ::handle [p1 info lookup method exists] + + ? {nsf::cmd::info args $::handle} "" + ? {nsf::cmd::info body $::handle} "" + ? {nsf::cmd::info definition $::handle} "" + ? {nsf::cmd::info exists $::handle} 0 + ? {nsf::cmd::info registrationhandle $::handle} "" + ? {nsf::cmd::info definitionhandle $::handle} "" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "" + ? {nsf::cmd::info syntax $::handle} "" + ? {nsf::cmd::info type $::handle} "" + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # Define 2 nsf::procs: one, which requires the nsf argument parser, + # and one, which does not. + # + nsf::proc ::foo {{-x 1} y:optional} {return $x-$y} + nsf::proc ::bar {a b} {return $a-$b} + + # + # An nsf::proc requiring nsf argument parser + # + set ::handle ::foo + + ? {nsf::cmd::info args $::handle} "x y" + ? {nsf::cmd::info body $::handle} {return $x-$y} + ? {nsf::cmd::info definition $::handle} {::nsf::proc ::foo {{-x 1} y:optional} {return $x-$y}} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} "" + ? {nsf::cmd::info definitionhandle $::handle} "" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "{-x 1} y:optional" + ? {nsf::cmd::info syntax $::handle} {?-x /value/? ?/y/?} + ? {nsf::cmd::info type $::handle} "nsfproc" + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # A simple Tcl proc + # + set ::handle ::bar + + ? {nsf::cmd::info args $::handle} "a b" + ? {nsf::cmd::info body $::handle} {return $a-$b} + ? {nsf::cmd::info definition $::handle} {::proc bar {a b} {return $a-$b}} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} "" + ? {nsf::cmd::info definitionhandle $::handle} "" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "a b" + ? {nsf::cmd::info syntax $::handle} {/a/ /b/} + ? {nsf::cmd::info type $::handle} "proc" + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # A Tcl cmd implemented in C + # + set ::handle ::set + + ? {nsf::cmd::info args $::handle} "could not obtain parameter definition for method 'set'" + ? {nsf::cmd::info body $::handle} {} + ? {nsf::cmd::info definition $::handle} {} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} "" + ? {nsf::cmd::info definitionhandle $::handle} "" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "could not obtain parameter definition for method 'set'" + ? {nsf::cmd::info syntax $::handle} "could not obtain parameter definition for method 'set'" + ? {nsf::cmd::info type $::handle} "cmd" + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" + + # + # A Tcl cmd implemented in C with the nsf infrastructure (with parameter definitions) + # + set ::handle ::nsf::cmd::info + + ? {nsf::cmd::info args $::handle} "subcmd -context methodName pattern" + ? {nsf::cmd::info body $::handle} {} + ? {nsf::cmd::info definition $::handle} {} + ? {nsf::cmd::info exists $::handle} 1 + ? {nsf::cmd::info registrationhandle $::handle} "" + ? {nsf::cmd::info definitionhandle $::handle} "" + ? {nsf::cmd::info origin $::handle} "" + ? {nsf::cmd::info parameter $::handle} "subcmd -context:object methodName pattern:optional" + ? {nsf::cmd::info syntax $::handle} "args|body|definition|exists|registrationhandle|definitionhandle|origin|parameter|syntax|type|precondition|postcondition|submethods|returns ?-context /object/? /methodName/ ?/pattern/?" + ? {nsf::cmd::info type $::handle} "cmd" + ? {nsf::cmd::info precondition $::handle} "" + ? {nsf::cmd::info postcondition $::handle} "" + ? {nsf::cmd::info submethods $::handle} "" + ? {nsf::cmd::info returns $::handle} "" +} + + +# +# test virtual arg resolution + filtering +# +nx::test case nsf-method-get-variants { + + nx::Class create Person { + :property name + :create p1 + } + + set ::handle1 [p1 info lookup method configure] + set ::handle2 [Person info lookup method create] + set ::handle3 [Person info lookup method new] + + # + # configure + # + ? {nsf::cmd::info syntax -context p1 $::handle1} \ + "?-name /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + + ? {nsf::cmd::info parameter -context p1 $::handle1} \ + "-name -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" + + ? {nsf::cmd::info args -context p1 $::handle1} \ + "name object-mixin class object-filter __initblock" + + # + # filter on (virtual) arguments + # + ? {nsf::cmd::info parameter -context p1 $::handle1 na*} "-name" + ? {nsf::cmd::info args -context p1 $::handle1 na*} "name" + ? {nsf::cmd::info syntax -context p1 $::handle1 na*} "?-name /value/?" + + ? {nsf::cmd::info parameter -context p1 $::handle1 *a*} "-name -class:class,alias,method=::nsf::methods::object::class" + ? {nsf::cmd::info args -context p1 $::handle1 *a*} "name class" + ? {nsf::cmd::info syntax -context p1 $::handle1 *a*} "?-name /value/? ?-class /class/?" + + + # + # create + # + ? {nsf::cmd::info syntax -context Person $::handle2} \ + "/objectName/ ?-name /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + + ? {nsf::cmd::info parameter -context Person $::handle2} \ + "objectName -name -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" + + ? {nsf::cmd::info args -context Person $::handle2} \ + "objectName name object-mixin class object-filter __initblock" + + + # + # new + # + ? {nsf::cmd::info syntax -context Person $::handle3} \ + "?-childof /value/? ?-name /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + ? {nsf::cmd::info parameter -context Person $::handle3} \ + "-childof -name -object-mixin:mixinreg,slot=::nx::Object::slot::object-mixin,slotset,0..n -class:class,alias,method=::nsf::methods::object::class -object-filter:filterreg,slot=::nx::Object::slot::object-filter,slotset,0..n __initblock:cmd,optional,noleadingdash" + ? {nsf::cmd::info args -context Person $::handle3} \ + "-childof name object-mixin class object-filter __initblock" + + # + # filter on (virtual) arguments + # + ? {nsf::cmd::info parameter -context Person $::handle3 na*} "-name" + ? {nsf::cmd::info args -context Person $::handle3 na*} "name" + ? {nsf::cmd::info syntax -context Person $::handle3 na*} "?-name /value/?" + + ? {nsf::cmd::info parameter -context Person $::handle3 *a*} "-name -class:class,alias,method=::nsf::methods::object::class" + ? {nsf::cmd::info args -context Person $::handle3 *a*} "name class" + ? {nsf::cmd::info syntax -context Person $::handle3 *a*} "?-name /value/? ?-class /class/?" + + ? {nsf::cmd::info args -context Person $::handle3 *il*} "-childof object-filter" + + + # + # queries without context + # + ? {nsf::cmd::info parameter $::handle1} args:virtualobjectargs + ? {nsf::cmd::info parameter $::handle2} "objectName args:virtualclassargs" + ? {nsf::cmd::info parameter $::handle3} "-childof args:virtualclassargs" + + + # + # Test cases, where no instance was created yet (no internally + # cached parameters) + # + + nx::Class create Student { :property matnr } + + set ::handle4 [Student info lookup method create] + + ? {nsf::cmd::info syntax -context Student $::handle4} \ + "/objectName/ ?-matnr /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" +} + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: tests/object-system.test =================================================================== diff -u -rd9344280c05990c0254aa652a08a09da3e5822b1 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/object-system.test (.../object-system.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) +++ tests/object-system.test (.../object-system.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -194,8 +194,8 @@ #? {C::slot info vars} __parameter #? {C info attributes} {{x 1} {y 2}} -? {C info configure parameters x} {{-x 1}} -? {C info configure parameters y} {{-y 2}} +? {C info lookup parameters create x} {{-x 1}} +? {C info lookup parameters create y} {{-y 2}} ? {C copy X} ::X ? {::nsf::object::exists X} 1 @@ -213,9 +213,9 @@ #? {X::slot info vars} __parameter -? {X info configure parameters ?} {{-x 1} {-y 2}} -? {X info configure parameters x} {{-x 1}} -? {X info configure parameters y} {{-y 2}} +? {X info lookup parameters create ?} {{-x 1} {-y 2}} +? {X info lookup parameters create x} {{-x 1}} +? {X info lookup parameters create y} {{-y 2}} #? {X info properties} {{x 1} {y 2}} #? {X info properties -closure *a*} {volatile:alias,noarg class:class,alias,method=::nsf::methods::object::class} Index: tests/parameters.test =================================================================== diff -u -ra093703e9836fc152fcbbce96d4f880ace6a6170 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/parameters.test (.../parameters.test) (revision a093703e9836fc152fcbbce96d4f880ace6a6170) +++ tests/parameters.test (.../parameters.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -1001,14 +1001,14 @@ :property {x:object,1..* {o}} } - ? {ParamTest info configure parameters o} "-o:object" - ? {ParamTest info configure parameters c} "-c:class" - ? {ParamTest info configure parameters c1} "-c1:class,type=::MC" - ? {ParamTest info configure parameters d} "-d:object,type=::C" - ? {ParamTest info configure parameters d1} "-d1:object,type=::C" - ? {ParamTest info configure parameters x} "{-x:object,1..* o}" - ? {ParamTest info configure parameters u} "-u:upper,slot=::ParamTest::slot::u" - ? {ParamTest info configure parameters us} "-us:upper,slot=::ParamTest::slot::us,1..*" + ? {ParamTest info lookup parameters create o} "-o:object" + ? {ParamTest info lookup parameters create c} "-c:class" + ? {ParamTest info lookup parameters create c1} "-c1:class,type=::MC" + ? {ParamTest info lookup parameters create d} "-d:object,type=::C" + ? {ParamTest info lookup parameters create d1} "-d1:object,type=::C" + ? {ParamTest info lookup parameters create x} "{-x:object,1..* o}" + ? {ParamTest info lookup parameters create u} "-u:upper,slot=::ParamTest::slot::u" + ? {ParamTest info lookup parameters create us} "-us:upper,slot=::ParamTest::slot::us,1..*" ? {ParamTest create p -o o} ::p ? {ParamTest create p -o xxx} \ @@ -2338,11 +2338,11 @@ # "info parameter syntax" or "info parameter definitions". # # ? {C info parameter list a} "-a" - ? {C info configure parameters a} "{-a a0}" -# ? {C info configure syntax a} "?-a /value/?" - ? {C info configure syntax} "/::C/ ?-a /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" + ? {C info lookup parameters create a} "{-a a0}" +# ? {C info lookup syntax create a} "?-a /value/?" + ? {C info lookup syntax create} "/objectName/ ?-a /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?" - ? {C info configure parameters v} "" + ? {C info lookup parameters create v} "" ? {[C info slots v] definition} "::C variable -accessor none v v0" # ? {C info parameter list v} "" # ? {C info configure parameter v} "" @@ -2392,8 +2392,8 @@ ? {lsort [c1 info vars]} {a v} # ... and we expect an object parameter for a but not for v ... - ? {C info configure parameters a} "{-a a0}" - ? {C info configure parameters v} "" + ? {C info lookup parameters create a} "{-a a0}" + ? {C info lookup parameters create v} "" # ... and we expect a setter for a but not for v ? {c1 info lookup method a} "::nsf::classes::C::a" @@ -2403,7 +2403,7 @@ # the object parameter and setters for "a" will be gone C delete variable v C delete property a - ? {C info configure parameters a} "" + ? {C info lookup parameters create a} "" ? {c1 info lookup method a} "" # already created instance variables will continue to exist @@ -2518,7 +2518,7 @@ } # "v" does NOT show up in "info configure parameters" - ? {C info configure parameters v} "" + ? {C info lookup parameters create v} "" # ? {C info parameter names} "noinit object-mixin class object-filter __initblock" # "v" does show up in "info slot ..." @@ -2533,7 +2533,7 @@ } # "p2" and "p3" do NOT show up in "info parameter" - ? {D info configure parameters p*} "{-p0 200} {-p1 201}" + ? {D info lookup parameters create p*} "{-p0 200} {-p1 201}" # "p1" and "p2" do NOT show up in "info methods" ? {D info methods} "p0 p3" @@ -2946,17 +2946,17 @@ :property m:metaclass } - ? {C info configure parameters foo} "-foo:integer" - ? {nsf::parameter::info type [C info configure parameters foo]} "integer" + ? {C info lookup parameters create foo} "-foo:integer" + ? {nsf::parameter::info type [C info lookup parameters create foo]} "integer" - ? {C info configure parameters o} "-o:object,type=::nx::Object" - ? {nsf::parameter::info type [C info configure parameters o]} "::nx::Object" + ? {C info lookup parameters create o} "-o:object,type=::nx::Object" + ? {nsf::parameter::info type [C info lookup parameters create o]} "::nx::Object" - ? {C info configure parameters c} "-c:class" - ? {nsf::parameter::info type [C info configure parameters c]} "class" + ? {C info lookup parameters create c} "-c:class" + ? {nsf::parameter::info type [C info lookup parameters create c]} "class" - ? {C info configure parameters m} "-m:metaclass" - ? {nsf::parameter::info type [C info configure parameters m]} "metaclass" + ? {C info lookup parameters create m} "-m:metaclass" + ? {nsf::parameter::info type [C info lookup parameters create m]} "metaclass" } # Index: tests/properties.test =================================================================== diff -u -ra093703e9836fc152fcbbce96d4f880ace6a6170 -r2f793442bb2a7860acc5620811dcafddc43074d3 --- tests/properties.test (.../properties.test) (revision a093703e9836fc152fcbbce96d4f880ace6a6170) +++ tests/properties.test (.../properties.test) (revision 2f793442bb2a7860acc5620811dcafddc43074d3) @@ -898,33 +898,33 @@ nx::Class create Foo nx::Class create Bar -superclass Foo - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 # # extend the superclass, subclass should become aware of this # Foo property y - ? {llength [Bar info configure parameters]} 5 + ? {llength [Bar info lookup parameters create]} 6 } nx::test case extend-parent-class-info-cache { nx::Class create Foo nx::Class create Bar -superclass Foo - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 # # Let Bar cache the objectparameters, and extend later the # superclass # Bar new Foo property y - ? {llength [Bar info configure parameters]} 5 + ? {llength [Bar info lookup parameters create]} 6 } nx::test case extend-parent-class-info-cache-configure { nx::Class create Foo nx::Class create Bar -superclass Foo - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 # # Let Bar cache the objectparameters, and extend later the # superclass @@ -941,19 +941,19 @@ nx::Class create Foo -mixin Baz nx::Class create Bar -mixin Foo Bar create bar; # cache becomes hot! - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 Foo property y - ? {llength [Bar info configure parameters]} 5 + ? {llength [Bar info lookup parameters create]} 6 Baz property z - ? {llength [Bar info configure parameters]} 6 + ? {llength [Bar info lookup parameters create]} 7 Baz delete property z - ? {llength [Bar info configure parameters]} 5 + ? {llength [Bar info lookup parameters create]} 6 Foo delete property y - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 } @@ -985,28 +985,31 @@ nx::Class create Foo nx::Class create Bar nx::Class create Baz + Bar create bar; # cache object parameters in class Bar Baz create baz; # cache object parameters in class Baz - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 + Foo property y - ? {llength [Bar info configure parameters]} 4 + ? {llength [Bar info lookup parameters create]} 5 Bar mixin add Foo - ? {llength [Bar info configure parameters]} 5 + ? {llength [Bar info lookup parameters create]} 6 ? {bar configure -y 1} "" - ? {llength [Baz info configure parameters]} 4 + ? {llength [Baz info lookup parameters create]} 5 Baz mixin add Bar - ? {llength [Baz info configure parameters]} 5 + ? {llength [Baz info lookup parameters create]} 6 Foo property z - ? {llength [Baz info configure parameters]} 6 + ? {llength [Baz info lookup parameters create]} 7 ? {baz configure -z 1} "" ? {bar configure -z 1} "" } +nx::test configure -count 1 nx::test case indirect-transitive-mixin-info { nx::Class create M0 @@ -1022,29 +1025,61 @@ M1 create m1 M2 create m2 - ? {llength [C info configure parameters]} 4 - ? {llength [D info configure parameters]} 4 - ? {llength [M0 info configure parameters]} 4 - ? {llength [M1 info configure parameters]} 4 - ? {llength [M2 info configure parameters]} 4 + ? {lmap p [C info lookup parameters create] {nsf::parameter::info name $p}} "objectName object-mixin class object-filter __initblock" + set base [llength [lmap p [C info lookup parameters create] {nsf::parameter::info name $p}]] + ? {llength [C info lookup parameters create]} $base + ? {llength [D info lookup parameters create]} $base + ? {llength [M0 info lookup parameters create]} $base + ? {llength [M1 info lookup parameters create]} $base + ? {llength [M2 info lookup parameters create]} $base + M0 property x - ? {llength [M0 info configure parameters]} 5 - ? {llength [M1 info configure parameters]} 5 - ? {llength [M2 info configure parameters]} 5 + ? {llength [M0 info lookup parameters create]} [expr {$base + 1}] + ? {llength [M1 info lookup parameters create]} [expr {$base + 1}] + ? {llength [M2 info lookup parameters create]} [expr {$base + 1}] C mixin add M2 - ? {llength [C info configure parameters]} 5 - ? {llength [D info configure parameters]} 5 + ? {C info heritage} "::M2 ::M1 ::M0 ::nx::Object" + ? {D info heritage} "::M2 ::M1 ::M0 ::C ::nx::Object" + ? {M2 info mixinof} "::C" + ? {M2 info mixinof -closure} "::C ::D" + + ? {M1 info mixinof} "" + ? {M1 info mixinof -closure} "::C ::D" + + ? {M0 info mixinof} "" + ? {M0 info mixinof -closure} "::C ::D" + + ? {lmap p [C info lookup parameters create] {nsf::parameter::info name $p}} "objectName x object-mixin class object-filter __initblock" + + ? {llength [C info lookup parameters create]} [expr {$base + 1}] + ? {llength [D info lookup parameters create]} [expr {$base + 1}] + + puts stderr =========-M1-property M1 property y - ? {llength [C info configure parameters]} 6 - ? {llength [D info configure parameters]} 6 - ? {llength [M0 info configure parameters]} 5 - ? {llength [M1 info configure parameters]} 6 - ? {llength [M2 info configure parameters]} 6 + puts stderr ========= + ? {C info heritage} "::M2 ::M1 ::M0 ::nx::Object" + + #::nsf::parameter:invalidate::classcache ::C + + ? {lmap p [C info lookup parameters create] {nsf::parameter::info name $p}} \ + "objectName y x object-mixin class object-filter __initblock" + + ? {lmap p [M0 info lookup parameters create] {nsf::parameter::info name $p}} \ + "objectName x object-mixin class object-filter __initblock" + + ? {lmap p [M1 info lookup parameters create] {nsf::parameter::info name $p}} \ + "objectName y x object-mixin class object-filter __initblock" + + ? {llength [C info lookup parameters create]} [expr {$base + 2}] + ? {llength [D info lookup parameters create]} [expr {$base + 2}] + ? {llength [M0 info lookup parameters create]} [expr {$base + 1}] + ? {llength [M1 info lookup parameters create]} [expr {$base + 2}] + ? {llength [M2 info lookup parameters create]} [expr {$base + 2}] }