Index: TODO =================================================================== diff -u -rf4c75b01b24269f7a531ffcffed29d2acfbdbe91 -r1beeb594c1cd9e222b6e1f419e9a6f5ec0713249 --- TODO (.../TODO) (revision f4c75b01b24269f7a531ffcffed29d2acfbdbe91) +++ TODO (.../TODO) (revision 1beeb594c1cd9e222b6e1f419e9a6f5ec0713249) @@ -2831,10 +2831,17 @@ - generate interface for NsfUnsetUnknownArgsCmd() - delete some obsolete code -TODO: +- added "link" from 2.4 (parameters) to "info parameters" in migration + guide -- add "link" form 2.4 (parameters) to "info parameters" +TODO: +- evaluate the folloging change + * make disposition an option of abritraty other types for objectparameters + * we could have a type e.g. class, which is checked as usual before calling + the disposition method + * this way we can handle "type" info in "info parameter syntax" automatically + - MixinComputeOrderFullList() could receive a flag to store source classes in checkList - if the check on eg. info-heritage-circular in test/info.method.tcl Index: doc/next-migration.html =================================================================== diff -u -r3fbf51ba5a40e2c77c9ecafb6fef70e51733b91a -r1beeb594c1cd9e222b6e1f419e9a6f5ec0713249 --- doc/next-migration.html (.../next-migration.html) (revision 3fbf51ba5a40e2c77c9ecafb6fef70e51733b91a) +++ doc/next-migration.html (.../next-migration.html) (revision 1beeb594c1cd9e222b6e1f419e9a6f5ec0713249) @@ -2140,8 +2140,8 @@ provide a generalized and highly orthogonal parameter handling with various kinds of value constraints (also called value checker). We divide the parameters into Object Parameters (parameters used for -initializing objects and classes, specified in XOTcl via the method -parameter) and Method Parameters (parameters passed to +initializing objects and classes, specified in XOTcl primarily via the +method parameter) and Method Parameters (parameters passed to methods). The Next Scripting Framework provide a unified, C-implemented infrastructure to handle both, object and method parameters.

@@ -2161,10 +2161,14 @@

based on the same mechanisms.

2.4.1. Object Parameters

-

Object parameters are supported in XOTcl via the method -parameter. Since the term "parameter" is underspecified, NX uses the -term "attribute". To define multiple attributes in a short form, NX -provides the method attributes.

+

Object parameters are used for specifying, how objects should be +initialized (what parameters can be passed in for initialization, what +default values are provided, etc.). Object parameters are supported +in XOTcl primarily via the method parameter, which is used to define +multiple parameters via a list of parameter specifications. Since the +term "parameter" is underspecified, NX uses the term "attribute". To +define multiple attributes in a short form, NX provides the method +attributes.

+

The Object parameters provided by a class for the initialization of +instances can be introspected via /cls/ info parameter (see +[info_parameter]).

2.4.2. Method Parameters

-

The method parameters specifications in XOTcl 1 were limited and -allowed only value constraints for non positional arguments.

+

Method paramters are used to sepcify the interface of a single method +(what kind of values may be passed to a method, what default values +are provided etc.). The method parameters specifications in XOTcl 1 +were limited and allowed only value constraints for non positional +arguments.

NX and XOTcl 2 provide value constraints for all kind of method parameters. While XOTcl 1 required non-positional arguments to be listed in front of positional arguments, this limitation is lifted in XOTcl 2.

@@ -4562,7 +4572,7 @@
-

2.6.10. List Object parameters

+

2.6.10. List Object parameters

# Return the full parameter specs /cls/info parameter spec ?name? +# Return the slot object(s) +/cls/info parameter slot ?name? + # Return in the Tcl parameter syntax /cls/info parameter syntax ?name? @@ -6308,7 +6321,7 @@ Index: doc/next-migration.txt =================================================================== diff -u -r56fc3af13d127cdfa54db9c89e8d44308b72bba9 -r1beeb594c1cd9e222b6e1f419e9a6f5ec0713249 --- doc/next-migration.txt (.../next-migration.txt) (revision 56fc3af13d127cdfa54db9c89e8d44308b72bba9) +++ doc/next-migration.txt (.../next-migration.txt) (revision 1beeb594c1cd9e222b6e1f419e9a6f5ec0713249) @@ -942,8 +942,8 @@ provide a generalized and highly orthogonal parameter handling with various kinds of value constraints (also called value checker). We divide the parameters into _Object Parameters_ (parameters used for -initializing objects and classes, specified in XOTcl via the method -+parameter+) and _Method Parameters_ (parameters passed to +initializing objects and classes, specified in XOTcl primarily via the +method +parameter+) and _Method Parameters_ (parameters passed to methods). The Next Scripting Framework provide a unified, C-implemented infrastructure to handle both, object and method parameters. @@ -957,10 +957,14 @@ ==== Object Parameters -Object parameters are supported in XOTcl via the method -+parameter+. Since the term "parameter" is underspecified, NX uses the -term "attribute". To define multiple attributes in a short form, NX -provides the method +attributes+. +Object parameters are used for specifying, how objects should be +initialized (what parameters can be passed in for initialization, what +default values are provided, etc.). Object parameters are supported +in XOTcl primarily via the method +parameter+, which is used to define +multiple parameters via a list of parameter specifications. Since the +term "parameter" is underspecified, NX uses the term "attribute". To +define multiple attributes in a short form, NX provides the method ++attributes+. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== @@ -1235,10 +1239,17 @@ ---------------- |====================== +The Object parameters provided by a class for the initialization of +instances can be introspected via +/cls/ info parameter+ (see +<>). + ==== Method Parameters -The method parameters specifications in XOTcl 1 were limited and -allowed only value constraints for non positional arguments. +Method paramters are used to sepcify the interface of a single method +(what kind of values may be passed to a method, what default values +are provided etc.). The method parameters specifications in XOTcl 1 +were limited and allowed only value constraints for non positional +arguments. NX and XOTcl 2 provide value constraints for all kind of method parameters. While XOTcl 1 required non-positional arguments to be listed in front of @@ -2041,7 +2052,7 @@ |====================== - +[[info_parameter]] ==== List Object parameters [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] Index: generic/nsf.c =================================================================== diff -u -rf4c75b01b24269f7a531ffcffed29d2acfbdbe91 -r1beeb594c1cd9e222b6e1f419e9a6f5ec0713249 --- generic/nsf.c (.../nsf.c) (revision f4c75b01b24269f7a531ffcffed29d2acfbdbe91) +++ generic/nsf.c (.../nsf.c) (revision 1beeb594c1cd9e222b6e1f419e9a6f5ec0713249) @@ -9482,7 +9482,7 @@ } else if (optionLength >= 6 && strncmp(option, "type=", 5) == 0) { if (paramPtr->converter != Nsf_ConvertToObject && paramPtr->converter != Nsf_ConvertToClass) - return NsfPrintError(interp, "option type= only allowed for object or class"); + return NsfPrintError(interp, "option type= only allowed for object or class"); paramPtr->converterArg = Tcl_NewStringObj(option + 5, optionLength - 5); INCR_REF_COUNT(paramPtr->converterArg); Index: library/nx/nx.tcl =================================================================== diff -u -r679a4d086fb9b8a728e0d33f5fa6520f2ce2f954 -r1beeb594c1cd9e222b6e1f419e9a6f5ec0713249 --- library/nx/nx.tcl (.../nx.tcl) (revision 679a4d086fb9b8a728e0d33f5fa6520f2ce2f954) +++ library/nx/nx.tcl (.../nx.tcl) (revision 1beeb594c1cd9e222b6e1f419e9a6f5ec0713249) @@ -1023,6 +1023,7 @@ # multiplicty at the level of the ObjectParameter. We want to have # the same interface as on Attribute. set options ${:disposition} + #if {[info exists :elementtype]} {lappend options type=${:elementtype}} if {${:name} ne ${:methodname}} {lappend options arg=${:methodname}} if {${:required}} { lappend options required @@ -1107,7 +1108,7 @@ ::nsf::relation RelationSlot superclass ObjectParameterSlot createBootstrapAttributeSlots ::nx::RelationSlot { - {elementtype ::nx::Class} + {elementtype class} {nosetter false} } @@ -1154,9 +1155,6 @@ } set value [::nsf::dispatch $value -frame method ::nsf::self] } - if {![::nsf::is class ${:elementtype}]} { - error "$value does not appear to be of type ${:elementtype}" - } } set p [lsearch -exact $old $value] if {$p > -1} {