Index: TODO =================================================================== diff -u -re29434ffef30bea10b7422f1f295787d41377839 -re570f0508ee82bd7aeea0409c64855bb99ea5cee --- TODO (.../TODO) (revision e29434ffef30bea10b7422f1f295787d41377839) +++ TODO (.../TODO) (revision e570f0508ee82bd7aeea0409c64855bb99ea5cee) @@ -2803,21 +2803,22 @@ -nsf.c: added c-implementation of "/object/ info slots" to share implementation details and reduce scattering +- migration guide + * included change in "info heritage" + * included "info slots" + * included "info parameter" + * included "delete method" + * included "delete attribute" + TODO: -- missing in c-based "info slots": - * handle object specific "info slots" in C? - * "info slots", "info parameter" are not in the migration guide - * add method "delete method" and "delete attribute" to the migration guide +- add "link" form 2.4 (parameters) to "info parameters" - MixinComputeOrderFullList() could receive a flag to store source classes in checkList - if the check on eg. info-heritage-circular in test/info.method.tcl fails, we get an exception. -- what to do with "info heritage": - document changed results in cases of per-class mixins in migratin guide - - ::nsf::method::exists /handle/ -> check, if handle is a handle of a registered method (to be be used in serializer alias-dependency) - profiling missing when NSF_INVOKE_SHADOWED_TRADITIONAL is turned off. Index: doc/next-migration.html =================================================================== diff -u -r01cc3b2a2d0ccf8b420fb73ab01c70308ac85d90 -re570f0508ee82bd7aeea0409c64855bb99ea5cee --- doc/next-migration.html (.../next-migration.html) (revision 01cc3b2a2d0ccf8b420fb73ab01c70308ac85d90) +++ doc/next-migration.html (.../next-migration.html) (revision e570f0508ee82bd7aeea0409c64855bb99ea5cee) @@ -1582,7 +1582,67 @@ the default protection for attributes. The defaults can be overwritten also e.g. on a class level.

+
+

2.2.4. Method and Attribute Deletion

+

NX provides an explicit delete method for the deletion of methods +and attributes.

+
+ +++ + + + + + + + + + + + +
XOTcl Next Scripting Language
+
+
# XOTcl provides only method deletion with
+# the equivalent of  Tcl's "proc foo {} {}"
+/obj/ proc foo {} {}
+/cls/ instproc foo {} {}
+
+# No support for attribute deletion
+
+
# Deletion of Methods
+#
+/obj/ delete method /name/
+/cls/ ?class? delete method /name/
+
+# Deletion of Attributes
+/obj/ delete attribute /name/
+/cls/ ?class? delete attribute /name/
+
+

2.3. Resolvers

The Next Scripting Framework defines Tcl resolvers for method and @@ -2391,8 +2451,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -

# Value constraints for parameter
-# not available
+
# No value constraints for parameter
+# available
# List slot objects defined for obj
-/obj/ info lookup slots ?-type /type/? ?-source
-all
+# -source might be all|application|baseclasses +# -type is the class of the slot object + +/obj/ info lookup slots ?-type ...? ?-source ... ?pattern? + +# Returns list of slot objects - -

application

-

baseclasses? ?pattern? -# Returns list of slot objects of specified type (class) and origin

-
-
-
-
-
-

2.6.6. List object/class where some method is defined

+

2.6.6. List object/class where a specified method is defined

info lookup can be used as well to determine, where exactly an artefact is located. One can obtain this way a method handle, where a method or filter is defined.

@@ -4452,7 +4507,127 @@ class as shown in examples above.

-

2.6.9. List Filter or Mixins

+

2.6.9. List Slots

+
+ +++ + + + + + + + + + + + +
XOTcl Next Scripting Language
+
+
# n.a.
+
+
# Return  list of slots objects defined on the
+# object or class
+#
+# -source might be all|application|baseclasses
+# -type is the class of the slot object
+# -closure includes slots of superclasses
+
+/obj/ info slots ?-type ...? ?pattern?
+/cls/ class info slots ?-type ...? ?pattern?
+/cls/ info slots ?-type ...? ?-source ...? ?-closure? ?pattern?
+
+
+
+

2.6.10. List Object parameters

+
+ +++ + + + + + + + + + + + +
XOTcl Next Scripting Language
+
+
# n.a.
+
+
# Return  parameter(s) provided by class for
+# its instances; defines, how objects of this
+# class can be configured. If name is provided
+# only the named object parameter is returned
+# otherwise the full list.
+#
+#
+# Return object parameters with leading dashes
+# for non-positional object parameters and
+# defaults
+/cls/ info parameter list ?name?
+
+# Return just the names of the parameters
+/cls/ info parameter name ?name?
+
+# Return the full parameter specs
+/cls/ info parameter spec ?name?
+
+# Return in the Tcl parameter syntax
+/cls/ info parameter syntax ?name?
+
+
+
+

2.6.11. List Filter or Mixins

In NX all introspection options for filters are grouped under info filter and all introspection options for mixins are under info mixin. Therefore, NX follows here the approach of using hierarchical @@ -4800,7 +4975,7 @@

-

2.6.10. List definition of methods defined by aliases, setters or forwarders

+

2.6.12. List definition of methods defined by aliases, setters or forwarders

As mentioned earlier, info method definition can be used on every kind of method.

@@ -4841,40 +5016,15 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/obj/ info method definition /methodName/
+
/obj/ info method definition /methodName/
+/cls/ ?class? info method definition /methodName/
- -
-
-
# n.a.
-
-
-
/cls/ info method definition /methodName/
-
-

2.6.11. List Method-Handles

+

2.6.13. List Method-Handles

NX supports method-handles to provide means to obtain further information about a method or to change maybe some properties of a method. When a method is created, the method creating method returns @@ -4917,40 +5067,15 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -

/obj/ info method handle /methodName/
+
/obj/ info method handle /methodName/
+/cls/ ?class? info method handle /methodName/
- -
-
-
# n.a.
-
-
-
/cls/ ?class? info method handle /methodName/
-
-

2.6.12. List type of a method

+

2.6.14. List type of a method

The method info method type is new in NX to obtain the type of the specified method.

@@ -5024,7 +5149,7 @@
-

2.6.13. List the scope of mixin classes

+

2.6.15. List the scope of mixin classes

NX provides a richer set of introspection options to obtain information, where mixins classes are mixed into.

@@ -5144,7 +5269,7 @@
-

2.6.14. Check properties of object and classes

+

2.6.16. Check properties of object and classes

Similar as noted before, NX uses rather a hierarchical approach of naming using multiple layers of subcommands).

@@ -5322,7 +5447,7 @@
-

2.6.15. Call-stack Introspection

+

2.6.17. Call-stack Introspection

Call-stack introspection is very similar in NX and XOTcl. NX uses for subcommand the term current instead of self, since self has a strong connotation to the current object. The term proc is renamed @@ -6103,7 +6228,14 @@ # alternate approach via Next Scripting Framework ::nsf::relation f1 class ::nx::Object

+
+

3.2.4. Info heritage

+

info heritage returns in XOTcl 1 the transitive superclass +hierarchy, which is equivalent with info superclass -closure and +therefore not necessary. In XOTcl 2 (and NX), info heritage includes +as well the transitive per-class mixins.

+

3.3. Calling Objects via Method Interface

Since the Next Scripting Framework supports the so-called ensemble @@ -6176,7 +6308,7 @@

Index: doc/next-migration.txt =================================================================== diff -u -r01cc3b2a2d0ccf8b420fb73ab01c70308ac85d90 -re570f0508ee82bd7aeea0409c64855bb99ea5cee --- doc/next-migration.txt (.../next-migration.txt) (revision 01cc3b2a2d0ccf8b420fb73ab01c70308ac85d90) +++ doc/next-migration.txt (.../next-migration.txt) (revision e570f0508ee82bd7aeea0409c64855bb99ea5cee) @@ -653,6 +653,42 @@ the default protection for attributes. The defaults can be overwritten also e.g. on a class level. + + +[[method-deletion]] +==== Method and Attribute Deletion + +NX provides an explicit +delete+ method for the deletion of methods +and attributes. + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# XOTcl provides only method deletion with +# the equivalent of Tcl's "proc foo {} {}" +/obj/ proc foo {} {} +/cls/ instproc foo {} {} + +# No support for attribute deletion +---------------- +|[source,tcl] +---------------- +# Deletion of Methods +# +/obj/ delete method /name/ +/cls/ ?class? delete method /name/ + +# Deletion of Attributes +/obj/ delete attribute /name/ +/cls/ ?class? delete attribute /name/ +---------------- +|====================== + + + === Resolvers The Next Scripting Framework defines Tcl resolvers for method and @@ -1094,8 +1130,8 @@ |[source,tcl] ---------------- -# Value constraints for parameter -# not available +# No value constraints for parameter +# available ---------------- |[source,tcl] ---------------- @@ -1756,13 +1792,16 @@ |[source,tcl] ---------------- # List slot objects defined for obj -/obj/ info lookup slots ?-type /type/? ?-source -all|application|baseclasses? ?pattern? -# Returns list of slot objects of specified type (class) and origin +# -source might be all\|application\|baseclasses +# -type is the class of the slot object + +/obj/ info lookup slots ?-type ...? ?-source ... ?pattern? + +# Returns list of slot objects ---------------- |====================== -==== List object/class where some method is defined +==== List object/class where a specified method is defined +info lookup+ can be used as well to determine, where exactly an artefact is located. One can obtain this way a method handle, where @@ -1961,6 +2000,85 @@ For definition of class object specific methods, use the modifier +class+ as shown in examples above. + +==== List Slots + + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# n.a. +---------------- +|[source,tcl] +---------------- +# Return list of slots objects defined on the +# object or class +# +# -source might be all\|application\|baseclasses +# -type is the class of the slot object +# -closure includes slots of superclasses + +/obj/ info slots ?-type ...? ?pattern? +/cls/ class info slots ?-type ...? ?pattern? +/cls/ info slots ?-type ...? ?-source ...? ?-closure? ?pattern? +---------------- +|[source,tcl] +---------------- +# n.a. +---------------- +# List reachable slot objects defined for obj +# -source might be all\|application\|baseclasses +# -type is the class of the slot object + +/obj/ info lookup slots ?-type ...? ?-source ... ?pattern? + +# Returns list of slot objects +---------------- +|====================== + + + +==== List Object parameters + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# n.a. +---------------- +|[source,tcl] +---------------- +# Return parameter(s) provided by class for +# its instances; defines, how objects of this +# class can be configured. If name is provided +# only the named object parameter is returned +# otherwise the full list. +# +# +# Return object parameters with leading dashes +# for non-positional object parameters and +# defaults +/cls/ info parameter list ?name? + +# Return just the names of the parameters +/cls/ info parameter name ?name? + +# Return the full parameter specs +/cls/ info parameter spec ?name? + +# Return in the Tcl parameter syntax +/cls/ info parameter syntax ?name? +---------------- +|====================== + + + + ==== List Filter or Mixins In NX all introspection options for filters are grouped under +info @@ -2098,15 +2216,8 @@ |[source,tcl] ---------------- /obj/ info method definition /methodName/ +/cls/ ?class? info method definition /methodName/ ---------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ---------------- -/cls/ info method definition /methodName/ ----------------- |====================== @@ -2128,13 +2239,6 @@ |[source,tcl] ---------------- /obj/ info method handle /methodName/ ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- /cls/ ?class? info method handle /methodName/ ---------------- |====================== @@ -2575,6 +2679,11 @@ ::nsf::relation f1 class ::nx::Object ---------------- +==== Info heritage ++info heritage+ returns in XOTcl 1 the transitive superclass +hierarchy, which is equivalent with +info superclass -closure+ and +therefore not necessary. In XOTcl 2 (and NX), +info heritage+ includes +as well the transitive per-class mixins. === Calling Objects via Method Interface Index: library/lib/pp.tcl =================================================================== diff -u -rb3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b -re570f0508ee82bd7aeea0409c64855bb99ea5cee --- library/lib/pp.tcl (.../pp.tcl) (revision b3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b) +++ library/lib/pp.tcl (.../pp.tcl) (revision e570f0508ee82bd7aeea0409c64855bb99ea5cee) @@ -96,7 +96,7 @@ tell trace unset uplevel update upvar variable vwait while package public protected - method alias attribute forward + method alias attribute forward delete my next new self current create init new destroy alloc dealloc class superclass mixin filter guard