Index: doc/next-migration.txt =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r49ec35d640333d44ac0d495e724cf626d9b4ae78 --- doc/next-migration.txt (.../next-migration.txt) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ doc/next-migration.txt (.../next-migration.txt) (revision 49ec35d640333d44ac0d495e724cf626d9b4ae78) @@ -1,7 +1,7 @@ Migration Guide for the Next Scripting Language =============================================== Gustaf Neumann -v2.1, March 2011: +v2.0b5, June 2013: :Author Initials: GN :toc: :toclevels: 3 @@ -88,7 +88,7 @@ instance variables). The encapsulation of NX is stronger than in XOTcl but still weak compared to languages like C++; a developer can still access other objects' variables via some idioms, but NX _makes - accesses to other objects variables explicit_. The requiredness to + accesses to other objects' variables explicit_. The requiredness to make these accesses explicit should encourage developer to implement well defined interfaces to provide access to instance variables. @@ -127,7 +127,7 @@ arguments for methods, the Next Scripting Framework provides the same value checkers for positional and non-positional arguments of methods, as well as for positional and - non-positional object parameters (`-parameter` in + non-positional configure parameters (`-parameter` in XOTcl 1). .. While XOTcl 1 supported only non-positional arguments at the begin of the argument list, these can be used now at arbitrary @@ -182,11 +182,11 @@ [width="50%",frame="topbot",options="header,footer",cols="3,>1,>1"] |====================== ||NX|XOTcl -|Methods for Objects |20| 51 -|Methods for Classes | 3| 24 -|Info-methods for Objects |15| 25 -|Info-methods for Classes | 6| 24 -|Total | 44|124 +|Methods for Objects |15| 51 +|Methods for Classes | 9| 24 +|Info-methods for Objects |13| 25 +|Info-methods for Classes |11| 24 +|Total | 48|124 |====================== This comparison list compares mostly XOTcl 1 with NX, some features @@ -296,13 +296,13 @@ package require XOTcl 2.0 - # Define a class using XOTcl + # Define a class with a public method foo using XOTcl xotcl::Class C1 C1 instproc foo {} {puts "hello world"} package require nx - # Define a class using NX + # Define a class with a public method foo using NX nx::Class create C2 { :public method foo {} {puts "hello world"} } @@ -377,12 +377,13 @@ method, two names have to be provided (eg. +proc+ and +instproc+, +forward+ and +instforward+). -NX on the contrary uses the same term for defining inherited or +NX on the contrary uses the same term for defining instance method or object-specific methods. When the term (e.g. +method+) is used on a -class, the method will be inherited (applicable to the instances of -the class). When the term is used on an object, an object-specific -method is defined. NX uses the method modifier +class+ to -define a class-specific method (method for the class object). +class, the method will be an instance method (i.e. applicable to the +instances of the class). When the term is used on an object with the +modifier +object+, an object-specific method is defined. This way one +can define the same way object specific methods on an object as well +as on a class. Furthermore, both XOTcl and NX distinguish between scripted methods (section 3.2.1) and C-defined methods (section 3.2.2). Section 3.2.3 @@ -400,7 +401,7 @@ |[source,tcl] ---------------- -# Define method 'foo' and class +# Define instance method 'foo' and object # method 'bar' for a Class 'C' with separate # toplevel commands @@ -410,22 +411,22 @@ ---------------- |[source,tcl] ---------------- -# Define method and class method +# Define instance method and object method # in the init-block of a class Class create C { :method foo args {...} - :class method bar args {...} + :object method bar args {...} } ---------------- [source,tcl] ---------------- -# Define method and class method +# Define instance method and object method # with separate commands Class create C C method foo args {...} -C class method bar args {...} +C object method bar args {...} ---------------- |[source,tcl] @@ -440,24 +441,24 @@ |[source,tcl] ---------------- -# Define class method and set +# Define object method and set # instance variable in the init-block of # an object Object create o { set :x 1 - :method foo args {...} + :object method foo args {...} } ---------------- [source,tcl] ---------------- -# Define class method and set +# Define object method and set # instance variable with separate # commands Object create o o eval {set :x 1} -o method foo args {...} +o object method foo args {...} ---------------- |=========================== @@ -489,10 +490,9 @@ ---------------- # Methods for defining methods: # -# method -# forward # alias -# property +# forward +# method # # All these methods return method-handles. ---------------- @@ -504,9 +504,10 @@ accessor functions are used normally internally when object-specific parameters are defined (see Section 3.4). -In NX forwarders are called +forward+. NX does not provide an own -method to define variable accessors, but uses the Next Scripting -Framework primitive +nsf::method::setter+ for it. +In NX forwarders are called +forward+. NX does not provide an public +available method to define variable accessors like +parametercmd+ in +XOTcl, but use interanlly the Next Scripting Framework primitive ++nsf::method::setter+ when appropriate. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== @@ -528,11 +529,11 @@ Class create C { :forward f1 ... - :class forward f2 ... + :object forward f2 ... } Object create o { - :forward f3 ... + :object forward f3 ... } ---------------- @@ -591,11 +592,11 @@ Class create C { :alias a1 ... - :class alias a2 ... + :object alias a2 ... } Object create o { - :alias a3 ... + :object alias a3 ... } ---------------- |=========================== @@ -604,10 +605,10 @@ [[method-protect-example]] ==== Method Modifiers and Method Protection -NX supports four method modifiers +class+, +public+, +protected+ and +NX supports four method modifiers +object+, +public+, +protected+ and +private+. All method modifiers can be written in front of every -method defining command. The method modifier +class+ is used to denote -class-specific methods (see above). The concept of method protection +method defining command. The method modifier +object+ is used to denote +object-specific methods (see above). The concept of method protection is new in NX. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] @@ -618,7 +619,7 @@ ---------------- # Method modifiers # -# "class", +# "object", # "public", # "protected", and # "private" @@ -629,14 +630,14 @@ ---------------- # Method modifiers # -# "class", +# "object", # "public", # "protected" # -# are applicable for all kinds of method -# defining methods: +# are applicable for all kinds of +# method defining methods: # -# method, forward, alias, property +# method, forward, alias # # The modifier "private" is available for # @@ -647,10 +648,10 @@ :public /method-definiton-method/ ... :protected /method-definiton-method/ ... :private /method-definiton-method/ ... - :class /method-definiton-method/ ... - :public class /method-definiton-method/ ... - :protected class /method-definiton-method/ ... - :private class /method-definiton-method/ ... + :object /method-definiton-method/ ... + :public object /method-definiton-method/ ... + :protected object /method-definiton-method/ ... + :private object /method-definiton-method/ ... } ---------------- |====================== @@ -659,10 +660,8 @@ defined per default as protected. This default can be changed by the application developer in various ways. The command `::nx::configure defaultMethodCallProtection true|false` can be used to set the default -call protection for scripted methods, forwarder and aliases, while -`::nx::configure defaultPropertyCallProtection true|false` can set -the default protection for properties. The defaults can be overwritten -also e.g. on a class level. +call protection for scripted methods, forwarder and aliases. +The defaults can be overwritten also on a class level. NX provides means for method hiding via the method modifier +private+. Hidden methods can be invoked only via the +-local+ flag, @@ -675,7 +674,8 @@ |[source,tcl] ---------------- -# XOTcl provides no means for method hiding +# XOTcl provides no means for +# method hiding ---------------- |[source,tcl] ---------------- @@ -701,10 +701,9 @@ [[method-deletion]] -==== Method and Property Deletion +==== Method Deletion -NX provides an explicit +delete+ method for the deletion of methods -and properties. +NX provides an explicit +delete+ method for the deletion of methods. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== @@ -714,21 +713,15 @@ ---------------- # XOTcl provides only method deletion with # the equivalent of Tcl's "proc foo {} {}" -/obj/ proc foo {} {} /cls/ instproc foo {} {} - -# No support for property deletion +/obj/ proc foo {} {} ---------------- |[source,tcl] ---------------- # Deletion of Methods # -/obj/ delete method /name/ -/cls/ ?class? delete method /name/ - -# Deletion of Properties -/obj/ delete property /name/ -/cls/ ?class? delete property /name/ +/cls/ delete method /name/ +/obj/ delete object method /name/ ---------------- |====================== @@ -766,7 +759,7 @@ C instproc foo args {...} C instproc bar args { my foo 1 2 3 ;# invoke own method - o baz ;# invoke other objects method + o baz ;# invoke other object's method } Object o o proc baz {} {...} @@ -777,11 +770,11 @@ :method foo args {...} :method bar args { :foo 1 2 3 ;# invoke own method - o baz ;# invoke other objects method + o baz ;# invoke other object's method } } Object create o { - :public method baz {} {...} + :public object method baz {} {...} } ---------------- |====================== @@ -855,7 +848,7 @@ # resolver (preferred and fastest way) ... method ... { - set /:newVar/ ?value? + set :/newVar/ ?value? } ---------------- |[source,tcl] @@ -886,13 +879,13 @@ # Read own instance variable ... method ... { - set /varName/ [set /:otherVar/] + set /varName/ [set :/otherVar/] } ---------------- [source,tcl] ---------------- ... method ... { - set /newVar/ ${/:otherVar/} + set /newVar/ ${:/otherVar/} } ---------------- |[source,tcl] @@ -906,7 +899,7 @@ # Test existence of own instance variable ... method ... { - info /:varName/ + info :/varName/ } ---------------- [source,tcl] @@ -933,7 +926,7 @@ # value via resolver # (preferred way: define property on obj) -/obj/ eval [list set /:varName/ ?value?] +/obj/ eval [list set :/varName/ ?value?] ---------------- |[source,tcl] ---------------- @@ -944,7 +937,7 @@ # Read instance variable of object obj # via resolver -set /varName/ [/obj/ eval {set /:otherVar/}] +set /varName/ [/obj/ eval {set :/otherVar/}] ---------------- |[source,tcl] ---------------- @@ -972,7 +965,7 @@ # Test existence of instance variable of # object obj -/obj/ eval {info exists /:varName/} +/obj/ eval {info exists :/varName/} ---------------- [source,tcl] ---------------- @@ -988,7 +981,7 @@ checkers). Parameters are used to specify, - how objects and classes are initialized (we call these parameter types - _Object Parameters_), and + _Configure Parameters_), and - what values can be passed to methods (we call these _Method Parameters_). @@ -999,45 +992,60 @@ both, object and method parameters in the same way with a high degree of orthogonality. -Object Parameters were specified in XOTcl 1 primarily via the method -+parameter+ in a rather limited way, XOTcl 1 only supported -non-positional parameters in front of positional ones, there were no -value constraints for positional parameters, no distinction between -optional and required, or multiplicity. +Configuration parameters were specified in XOTcl 1 primarily via the +method +parameter+ in a rather limited way, XOTcl 1 only supported +non-positional parameters in front of positional ones, supported no +value constraints for positional parameters, provided no distinction +between optional and required, and did not support multiplicity. Furthermore, the Next Scripting Framework provides optionally _Return Value Checking_ based on the same mechanism to check whether some methods return always the values as specified. -==== Instance Variables and Object Parameters +==== Parameters for Configuring Objects: Variables and Properties -Object parameters are used for specifying, how objects are -initialized (i.e. how instance variables are initialized, what -parameters can be passed in for initialization, what default values -are used, etc.). Object parameters are supported in XOTcl primarily -via the method +parameter+, which is used in XOTcl to define multiple -parameters via a list of parameter specifications. Since the term -"parameter" is underspecified, NX uses a more differentiated -terminology. NX distinguishes between instance variables with -accessors (also called properties) and instance variables without -accessors. To define a property, NX uses the method +property+, to -define an instance variable without accessor, it uses the method -+variable+. To define multiple properties in a short form (similar to -XOTcl's +parameter+), NX provides the method +properties+. +Configure parameters are used for specifying values for configuring +objects when they are created (i.e. how instance variables are +initialized, what parameters can be passed in for initialization, what +default values are used, etc.). Such configuration parameters are +supported in XOTcl primarily via the method +parameter+, which is used +in XOTcl to define multiple parameters via a list of parameter +specifications. -In a first step, we show the initialization of instance variables -without accessors (using +variable+ in NX), and then the definition of -instance variables with accessors (using +property+). +Since the term "parameter" is underspecified, NX uses a more +differentiated terminology. NX distinguishes between configurable +instance variables (also called _properties_) and non configurable +instance variables (called _variables_), which might have as well +e.g. default values. The values of configurable properties can be +queried at runtime via +cget+, and their values can be altered via ++configure+. When the value of a configure parameter is provided or +changed, the value checkers from the variable definition are used to +ensure, the value is permissible (i.e. it is for example an integer +value). The sum of all configurable object parameters are called +_configure parameters_. To define a define a configurable variable, NX +uses the method +property+, for non-configurable variables, the method ++variable+ is used. +Optionally, one can define in NX, that a +property+ or a ++variable+ should have a public, protected or private accessor. Such +an accessor is a method with the same name as the variable. In XOTcl, +every +parameter+ defined as well automatically a same-named accessor +method, leading to potential name conflicts with other method names. + +In the examples below we show the definition of configurable an +non-configurable instance variables using +variable+ and +property+ +respectively. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- -# Define that instances of the class have -# a instance variables "x" and "y" initialized -# with some values +# Define class "Foo" with instance +# variables "x" and "y" initialized +# on instance creation. The initialization +# has to be performed in the constructor. Class Foo Foo instproc init args { @@ -1054,11 +1062,13 @@ ---------------- |[source,tcl] ---------------- - +# Define class "Foo" with instance variables +# "x" and "y" initialized on instance creation. # The method "variable" is similar in syntax -# to Tcl's "variable" command. During object -# creation, the definition are used for the -# initialization of the object. +# to Tcl's "variable" command. During +# instance creation, the variable +# definitions are used for the +# initialization of the variables of the object. Class create Foo { :variable x 1 @@ -1074,14 +1084,15 @@ |====================== While XOTcl follows a procedural way to initialize variables via the -constructor +init+, NX follows a more declarative approach. Note, that -the variable definitions are inherited from superclasses, which is -straightforward in NX, while in XOTcl, the constructor has to call -explicitly the constructor of its superclasses. +constructor +init+, NX follows a more declarative approach. Often, +classes have superclasses, which often want to provide their own +instance variables and default values. The declarative approach from +NX solves this via inheritance, while an procedural approach via +assign statements in the constructor requires explicit constructor +calls, which are often error-prone. Certainly, when a user prefers to +assign initial values to instance variables via explicit assign +operations in constructors, this is as ell possible in NX. -It is certainly as well possible to use constructors in NX in the same -way as in XOTcl. - NX uses the same mechanism to define class variables or object variables. @@ -1097,32 +1108,43 @@ |[source,tcl] ---------------- -# Define a class variable "V" with value 100 and -# an instance variable "x". "class variable" works -# similar to "class method". +# Define a object variable "V" with value 100 and +# an instance variable "x". "V" is defined for the +# class object Foo, "x" is defined in the +# instances of the class. "object variable" works +# similar to "object method". Class create Foo { - :class variable V 100 + :object variable V 100 :variable x 1 } ---------------- |====================== -In the next step, we define properties, i.e. variables with accessors. +In the next step, we define configurable instance variables which we +call _properties_ in NX. XOTcl uses the method +parameter+ is a shortcut for creating multiple -properties. For every parameter definition, XOTcl creates as well a -slot object, keeping an extensible set of meta-data for every -parameter. Slot objects can be as well created in XOTcl directly via -the method +slots+. NX provides a similar method named +properties+. +configurable variables with automically created accessors (methods for +reading and writing of the variables). In NX, the prefered way to +create configurable variables is to use the method +property+. The +method +property+ in NX is similar to +variable+, but makes the +variables configurable, which means that +. one can specify the property as a non-positional parameter upon + creation of the object, +. one can query the value via the method +cget+, and +. one can modify the value of the underlying variable via the method + +configure+. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- -# Object parameter specified as a list (short form) +# Parameters specified as a list +# (short form); parameter # "a" has no default, "b" has default "1" Class Foo -parameter {a {b 1}} @@ -1132,160 +1154,111 @@ # Object f1 has instance variables # a == 0 and b == 1 + +# XOTcl registers automatically accessors +# for the parameters. Use the accessor +# "b" to output the value of variable "b" +puts [f1 b] + +# Use the setter to alter value of +# instance variable "b" +f1 b 100 ---------------- |[source,tcl] ---------------- -# Object parameter specified as a list -# (short form); "a" has no default, -# "b" has default "1" +# Define property "a" and "b". The +# property "a" has no default, "b" has +# default value "1" -Class create Foo -properties {a {b 1}} +Class create Foo { + :property a + :property {b 1} +} # Create instance of the class Foo Foo create f1 -a 0 # Object f1 has instance variables # a == 0 and b == 1 + +# Use the method "cget" to query the value +# of a configuration parameter +puts [f1 cget -b] + +# Use the method "configure" to alter the +# value of instance variable "b" +f1 configure -b 100 ---------------- |====================== -Since every property defines a slot object, NX provides as well a -scripted initialization for every slot object. Therefore, NX uses -+property+ to define a single property, similar in syntax to method -parameters (a braced pair to denote a variable with a default). The -method +property+ can be used in NX on the class and on the object -level (in XOTcl: just on the class level). When an property is -created, NX does actually three things: +In general, NX allows to create variables and properties with and +without accessor methods. The created accessor methods might be ++public+, +protected+ or +public+. When the value +none+ is provided +to +-accessor+, no accessor will be created. This is actually the +default in NX. In order to change the default behavior in NX, one can use ++::nx::configure defaultAccessor none|public|protected|private+. -. Create a slot object, which can be specified in more detail - using the init-block of the slot object -. Create an object parameter definition for the initialization of the - object (usable via a non-positional parameter during object - creation), and -. register an accessor function (setter), for wich the usual - protection levels (+public+, +protected+ or +private+) can be used. - -The method +variable+ in NX is similar to +property+, but it creates -only slot objects in cases where internally needed. +variable+ it does -neither provide object parameters, or naccessors. - -We show first the definition of properties simliar to the -functionality provided as well by XOTcl and show afterwards how to use -value constraints, optional parameters, etc. in NX. - [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- -# Object parameters specified via slots - -Class Foo -slots { - Attribute a - Attribute b -default 1 -} - -# Create instance of the class Foo and -# provide a value for instance variable "a" -Foo f1 -a 0 - -# Object f1 has a == 0 and b == 1 - -# Use the setter to alter instance variable "b" -f1 b 100 - -# Use the accessor to output the value -puts [f1 b] +# "parameter" creates always accessor +# methods, accessor methods are +# always public, no "cget" is available. ---------------- - |[source,tcl] ---------------- -# Object parameters specified via the method -# "property" (supports method modifiers and -# scripted configuration; see below) +# Define property "a" and "b". The +# property "a" has no default, "b" has +# default value "1" Class create Foo { - :property a - :property {b 1} + :variable -accessor public a + :property -accessor public {b 1} } -# Create instance of the class Foo and -# provide a value for instance variable "a" -Foo create f1 -a 0 - -# Object f1 has a == 0 and b == 1 - -# Use the setter to alter instance variable "b" -f1 b 100 - -# Use the accessor to output the value +# Use the accessor method to query +# the value of a configuration parameter puts [f1 b] + +# Use the accessor method to set the +# value of instance variable "a" +f1 a 100 ---------------- +|====================== +Similar to +variable+, properties can be defined in NX on the class +and on the object level. +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language |[source,tcl] ---------------- -# Parameters only available at class level +# XOTcl provides no means to define +# configurable variables at the object +# level ---------------- - |[source,tcl] ---------------- -# Define a class property and an object -# property +# Define class with a property for the class object +# named "cp". This is similar to "static variables" +# in some other object-oriented programming +# languages. -Class create C { - :property x - :property {y 1} - :class property cp +Class create Foo { + ... + :object property cp 101 } +# Define object property "op" + Object create o { - :property op + :object property op 102 } ---------------- - -|[source,tcl] ----------------- -# Object parameter with configured slot, -# defining an attribute specific type -# checker - -Class Person -slots { - Attribute create sex -type "sex" { - my proc type=sex {name value} { - switch -glob $value { - m* {return m} - f* {return f} - default { - error "expected sex but got $value" - } - } - } - } -} ----------------- -|[source,tcl] ----------------- -# Object parameter with scripted -# definition (init-block), defining a -# property specific type checker - -Class create Person { - :property sex { - :type "sex" - :method type=sex {name value} { - switch -glob $value { - m* {return m} - f* {return f} - default { - error "expected sex but got $value" - } - } - } - } -} ----------------- |====================== NX supports _value constraints_ (value-checkers) for object and method @@ -1302,8 +1275,8 @@ |[source,tcl] ---------------- -# No value constraints for parameter -# available +# No value constraints for +# parameter available ---------------- |[source,tcl] ---------------- @@ -1337,11 +1310,11 @@ ---------------- |====================== -In XOTcl all object parameters were _optional_. Required parameters have +In XOTcl all configure parameters were _optional_. Required parameters have to be passed to the constructor of the object. -NX allows to define _optional_ and _required_ object parameters (as -well as method parameters). Therefore, object parameters can be used +NX allows to define _optional_ and _required_ configure parameters (as +well as method parameters). Therefore, configure parameters can be used as the single mechanism to parameterize objects. It is in NX not necessary (and per default not possible) to pass arguments to the constructor. @@ -1387,7 +1360,8 @@ |[source,tcl] --------------- -# Multiplicity for parameter not available +# Multiplicity for parameter +# not available ----------------- |[source,tcl] ---------------- @@ -1412,10 +1386,147 @@ ---------------- |====================== -The Object parameters provided by a class for the initialization of -instances can be introspected via +/cls/ info parameter+ (see -<>). +For the implementation of variables and properties, NX uses slot +objects, which are an extension to the +-slots+ already available in +XOTcl. While very for every +property+ in NX, a slot object is created, +for performance reasons, not every +variable+ has a slot associated. + +When an property is created, NX does actually three things: + +. Create a slot object, which can be specified in more detail + using the init-block of the slot object +. Create a parameter definition for the initialization of the + object (usable via a non-positional parameter during object + creation), and +. register optionally an accessor function (setter), for which the usual + protection levels (+public+, +protected+ or +private+) can be used. + + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# Define parameters via slots + +Class Foo -slots { + Attribute a + Attribute b -default 1 +} + +# Create instance of the class Foo +# and provide a value for instance +# variable "a" +Foo f1 -a 0 + +# Object f1 has a == 0 and b == 1 +---------------- + +|[source,tcl] +---------------- +# Configurable parameters specified via the +# method "property" (supports method +# modifiers and scripted configuration; +# see below) + +Class create Foo { + :property a + :property {b 1} +} + +# Create instance of the class Foo and +# provide a value for instance variable "a" +Foo create f1 -a 0 + +# Object f1 has a == 0 and b == 1 +---------------- +|====================== + +Since the slots are objects, the slot objects can be configured and +parameterized like every other object in NX. Slot objects can be +provided with a scripted initialization as well. We show first the +definition of properties simliar to the functionality provided as well +by XOTcl and show afterwards how to use value constraints, optional +parameters, etc. in NX. + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# Define parameter with an an +# attribute-specific type checker + +Class Person -slots { + Attribute create sex -type "sex" { + my proc type=sex {name value} { + switch -glob $value { + m* {return m} + f* {return f} + default { + error "expected sex but got $value" + } + } + } + } +} +---------------- +|[source,tcl] +---------------- +# Configure parameter with scripted +# definition (init-block), defining a +# property specific type checker + +Class create Person { + :property sex { + :type "sex" + :object method type=sex {name value} { + switch -glob $value { + m* {return m} + f* {return f} + default { + error "expected sex but got $value" + } + } + } + } +} +---------------- +|====================== + +The configure parameters provided by a class for the initialization of +instances can be introspected via +/cls/ info configure parameters+ +(see <>). + +==== Delete Variable Handlers + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + +|[source,tcl] +---------------- +# No syntactic support for deleting +# variable handlers +---------------- +|[source,tcl] +---------------- +# Like deletion of Methods: +# Delete on the object, where the +# variable handler is defined. + +/cls/ delete property /name/ +/obj/ delete object property /name/ + +/cls/ delete variable /name/ +/obj/ delete object variable /name/ +---------------- +|====================== + + ==== Method Parameters Method parameters are used to specify the interface of a single method @@ -1439,7 +1550,13 @@ # parameter (a and b) Class C -C instproc foo {-x:integer -y:required -z a b} { +C instproc foo { + -x:integer + -y:required + -z + a + b +} { # ... } C create c1 @@ -1449,12 +1566,19 @@ ---------------- |[source,tcl] ---------------- -# Define method foo with non-positional -# parameters (x, y and y) and positional +# Define method foo with +# non-positional parameters +# (x, y and y) and positional # parameter (a and b) Class create C { - :public method foo {-x:integer -y:required -z a b} { + :public method foo { + -x:integer + -y:required + -z + a + b + } { # ... } :create c1 @@ -1465,10 +1589,12 @@ |[source,tcl] ---------------- -# Only leading non-positional parameters -# are available; no optional positional -# parameters, no value constraints on -# positional parameters, no multiplicity, ... +# Only leading non-positional +# parameters are available; no +# optional positional parameters, +# no value constraints on +# positional parameters, +# no multiplicity, ... ---------------- |[source,tcl] ---------------- @@ -1498,7 +1624,7 @@ } # In general, the same list of value - # constraints as for object parameter is + # constraints as for configure parameter is # available (see above). # # User defined value constraints are @@ -1523,7 +1649,8 @@ |[source,tcl] ---------------- -# No return value checking available +# No return value checking +# available ---------------- |[source,tcl] ---------------- @@ -1550,7 +1677,7 @@ # Define a method that has to return a # non-empty list of objects - :public class method instances {} \ + :public object method instances {} \ -returns object,1..n { return [:info instances] } @@ -1564,14 +1691,16 @@ XOTcl and NX allow the definition of the same set of interceptors, namely class- and object-level mixins and class- and object-level -filters. The primary difference in NX is the naming, since NX -abandons the prefix "inst" from the method names. +filters. The primary difference in NX is the naming, since NX abandons +the prefix "inst" from the names of instance specific method, but uses +the the modifier +objec+" for object specific methods. -Therefore, in NX, if a +mixin+ is registered on the class-level, it is -a per-class mixin, if the +mixin+ is registered on the object level, -it is a object-level mixin. In both cases, the method +mixin+ is used. -If a mixin is registered on the class object, one has to use the -modifier +class+ (in the same way as e.g. for defining methods). +Therefore, in NX, if a +mixin+ is registered on a class-level, it is +applicable for the instances (a per-class mixin), and if and +object +mixin+ is registered, it is a per-object mixin. In both cases, the +term +mixin+ is used, in the second case with the modifier ++object+. As in all other cases, one can register the same way a +per-object mixin on a plain object or on a class object. ==== Register Mixin Classes and Mixin Guards @@ -1594,19 +1723,6 @@ ---------------- |[source,tcl] ---------------- -/cls/ mixin ... -/cls/ mixin guard /mixin/ ?condition? ----------------- -|[source,tcl] ----------------- -# Register per-object mixin and guard for -# a class - -/cls/ class mixin ... -/cls/ class mixin guard /mixin/ ?condition? ----------------- -|[source,tcl] ----------------- /obj/ mixin ... /obj/ mixinguard /mixin/ ?condition? ---------------- @@ -1615,8 +1731,8 @@ # Register per-object mixin and guard for # an object -/obj/ mixin ... -/obj/ mixin guard /mixin/ ?condition? +/obj/ object mixin ... +/obj/ object mixin guard /mixin/ ?condition? ---------------- |====================== @@ -1632,19 +1748,6 @@ ---------------- |[source,tcl] ---------------- -# Register per-class filter and guard for -# a class - -/cls/ filter ... -/cls/ filter guard /filter/ ?condition? ----------------- -|[source,tcl] ----------------- -/cls/ filter ... -/cls/ filterguard ... ----------------- -|[source,tcl] ----------------- # Register per-object filter and guard for # a class @@ -1661,8 +1764,8 @@ # Register per-object filter and guard for # an object -/obj/ filter ... -/obj/ filter guard /filter/ ?condition? +/obj/ object filter ... +/obj/ object filter guard /filter/ ?condition? ---------------- |====================== @@ -1679,7 +1782,7 @@ scripted and C-implemented methods the same way, one one can get the definition of all methods via +info method definition+ and one can get an manual-like interface description via +info method -parametersyntax+. In addition, NX provides means to query the type of +syntax+. In addition, NX provides means to query the type of a method, and NX allows to filter by the type of the method. ==== List methods defined by classes @@ -1707,46 +1810,25 @@ ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype setter ?pattern? +/cls/ info methods -type setter ?pattern? ---------------- |[source,tcl] ---------------- /cls/ info instprocs ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype scripted ?pattern? +/cls/ info methods -type scripted ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype alias ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ info methods -methodtype forwarder ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ info methods -methodtype object ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- +/cls/ info methods -type alias ?pattern? +/cls/ info methods -type forwarder ?pattern? +/cls/ info methods -type object ?pattern? /cls/ info methods -callprotection public\|protected ... ---------------- |====================== @@ -1768,127 +1850,37 @@ ---------------- |[source,tcl] ---------------- -/obj/ info methods ?pattern? +/obj/ info object methods ?pattern? ---------------- |[source,tcl] ---------------- /obj/ info parametercmd ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype setter ?pattern? +/obj/ info object methods -type setter ?pattern? ---------------- |[source,tcl] ---------------- /obj/ info procs ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype scripted ?pattern? +/obj/ info object methods -type scripted ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype alias ?pattern? +/obj/ info object methods -type alias ?pattern? +/obj/ info object methods -type forwarder ?pattern? +/obj/ info object methods -type object ?pattern? +/obj/ info object methods -callprotection public\|protected ... ---------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/obj/ info methods -methodtype forwarder ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/obj/ info methods -methodtype object ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/obj/ info methods -callprotection public\|protected ... ----------------- |====================== -==== List class object specific methods - -When class specific properties are queried, NX required to use -the modifier +class+ (like for the definition of the methods). -In all other respects, this section is identical to the previous one. - -[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] -|====================== -|XOTcl |Next Scripting Language - -|[source,tcl] ----------------- -/cls/ info commands ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ class info methods ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ info parametercmd ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ class info methods -methodtype setter ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ info procs ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ class info methods -methodtype scripted ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ class info methods -methodtype alias ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ class info methods -methodtype forwarder ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ class info methods -methodtype object ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ class info methods \ - -callprotection public\|protected ... ----------------- -|====================== - ==== Check existence of a method NX provides multiple ways of checking, whether a method exists; one @@ -1911,20 +1903,11 @@ ---------------- |[source,tcl] ---------------- -/obj/ info method exists /methodName/ -/obj/ info methods /methodName/ +/cls/ info method exists /methodName/ +/cls/ info methods /methodName/ +/obj/ info object method exists /methodName/ +/obj/ info object methods /methodName/ ---------------- -|[source,tcl] ----------------- -/obj\|cls/ info \ - [inst](commands\|procs\|parametercmd) \ - ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ ?class? info method exists /methodName/ -/cls/ ?class? info methods /methodName/ ----------------- |====================== @@ -1972,7 +1955,7 @@ # -source ... # -callprotection ... # -incontext -# -methodtype ... +# -type ... # -nomixins ---------------- |[source,tcl] @@ -2025,7 +2008,7 @@ ----------------- |====================== -==== List definition of scripted methods defined by classes +==== List definition of scripted methods XOTcl contains a long list of +info+ subcommands for different kinds of methods and for obtaining more detailed information about these @@ -2037,11 +2020,12 @@ furthermore, it works as well the same way to obtain e.g. the definition of a _forwarder_ or an _alias_. -Another powerful introspection option in NX is +info method -parametersyntax+ which obtains a representation of the parameters of a -method in the style of Tcl man pages (regardless of the kind of -method). +While XOTcl uses different names for info options for objects and +classes (using the prefix "inst" for instance specific method), NX +uses for object specific method the modifier +object+. For definition +of class object specific methods, use the modifier +object+ as usual. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -2053,70 +2037,75 @@ |[source,tcl] ---------------- /cls/ info method definition /methodName/ +/obj/ info object method definition /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info instbody /methodName/ +/obj/ info body /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info method body /methodName/ +/obj/ info object method body /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info instargs /methodName/ +/obj/ info args /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info method args /methodName/ +/obj/ info object method args /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info instnonposargs /methodName/ +/obj/ info object method args /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info method parameter /methodName/ +/obj/ info object method parameter /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info instdefault /methodName/ +/obj/ info default /methodName/ ---------------- |[source,tcl] ---------------- -# not needed, part of "info method parameter" +# not needed, part of +# "info ?object? method parameter" ---------------- |[source,tcl] ---------------- /cls/ info instpre /methodName/ +/obj/ info pre /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info method precondition /methodName/ +/obj/ info object method precondition /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info instpost /methodName/ +/obj/ info post /methodName/ ---------------- |[source,tcl] ---------------- /cls/ info method postcondition /methodName/ +/obj/ info object method postcondition /methodName/ ---------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ info method parametersyntax /methodName/ ----------------- |====================== -==== List definition of scripted object specific methods +Another powerful introspection option in NX is +info ?object? method +syntax+ which obtains a representation of the parameters of a +method in the style of Tcl man pages (regardless of the kind of +method). -While XOTcl uses different names for info options for objects and -classes (using the prefix "inst"), the names in NX are the same. - [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -2127,73 +2116,20 @@ ---------------- |[source,tcl] ---------------- -/obj/ info method definition /methodName/ +/cls/ info method syntax /methodName/ +/obj/ info object method syntax /methodName/ ---------------- -|[source,tcl] ----------------- -/obj/ info body /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method body /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info args /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method args /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info nonposargs /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method parameter /methodName/ ----------------- -|[source,tcl] ---------------- -/obj/ info default /methodName/ ------------------ -|[source,tcl] ----------------- -# not needed, part of "info method parameter" ----------------- -|[source,tcl] ----------------- -/obj/ info pre /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method precondition /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info post /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method postcondition /methodName/ ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/obj/ info method parametersyntax /methodName/ ----------------- |====================== -For definition of class object specific methods, use the modifier -+class+ as shown in examples above. +[[info_configure_parameter]] +==== List Configure Parameters +Obtain information, how newly created object can be configured. The +configuration of objects is performed in many languages over arguments +to the constructors. NX has - what we think - a superiour approach for +configuration via configure parameters. The configure parameter are +defined by NX application programs usually via +property+. -==== List Slots and their definitions - - [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -2204,110 +2140,119 @@ ---------------- |[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 +# Return configure parameter(s), the parameters +# provided by a class for its instances; these +# parameters define, how objects of this +# class can be configured. A pattern can +# be used to filter the results. -/obj/ info slot objects ?-type ...? ?pattern? -/cls/ class info slot objects ?-type ...? ?pattern? -/cls/ info slot objects \ - ?-type value? ?-closure? ?-source value? ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -# List definition of slots +/cls/ info configure parameters ?pattern? -/obj/ info slot definition \ - ?-type value? ?pattern? -/cls/ class info slot definition \ - ?-type value? ?pattern? -/cls/ info slot definition \ - ?-type value? ?-closure? ?-source value? ?pattern? +# Return in the Tcl parameter syntax + +/cls/ info configure syntax + +# "info lookup configure parameters" returns +# parameters available for configuring the +# current object (might contain object +# specific information) + +/obj/ info lookup configure parameters ?pattern? + + +# "info lookup configure syntax" returns syntax of +# a call to configure in the Tcl parameter syntax + +/obj/ info lookup configure syntax +# short form +/obj/ info configure + +# Obtain information from a parameter +# (as e.g. returned from "info configure +# parameters"). + +/obj/ info parameter name /parameter/ +/obj/ info parameter syntax /parameter/ ---------------- +|====================== + + +==== List Variable Declarations (property and variable) + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + |[source,tcl] ---------------- +# obtain parameter definitions defined +# for a class /cls/ info parameter ---------------- |[source,tcl] ---------------- -# "info properties" is a short form of "info slot definiton" +# "info variables" returns handles of +# properties and variables defined by this +# class or object -/cls/ info properties \ - ?-type value? ?-closure? ?-source value? ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -# List names of slots +/cls/ info variables ?pattern? +/obj/ info object variables ?pattern? -/obj/ info slot names \ - ?-type value? ?pattern? -/cls/ class info slot names \ - ?-type value? ?pattern? -/cls/ info slot names \ - ?-type value? ?-closure? ?-source value? ?pattern? ----------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -# List reachable slot objects defined for obj -# -source might be all\|application\|baseclasses -# -type is the class of the slot object +# "info lookup variables" returns handles +# of variables and properties applicable +# for the current object (might contain +# object specific information) -/obj/ info lookup slots \ - ?-type ...? ?-source ... ?pattern? +/obj/ info lookup variables /pattern/ -# Returns list of slot objects +# "info variable" lists details about a +# single property or variable. + +/obj/ info variable definition /handle/ +/obj/ info variable name /handle/ +/obj/ info variable parameter /handle/ ---------------- |====================== +==== List Slots -[[info_parameter]] -==== 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 list of slots objects defined on the +# object or class # -# -# Return object parameters with leading dashes -# for non-positional object parameters and -# defaults -/cls/ info parameter list ?name? +# -source might be all\|application\|baseclasses +# -type is the class of the slot object +# -closure includes slots of superclasses -# Return just the names of the parameters -/cls/ info parameter names ?name? +/cls/ info slots \ + ?-type value? ?-closure? ?-source value? ?pattern? +/obj/ info object slots ?-type ...? ?pattern? -# Return the full parameter specs -/cls/ info parameter definitions ?name? +# List reachable slot objects defined for obj +# -source might be all\|application\|baseclasses +# -type is the class of the slot object +# Returns list of slot objects. -# Return in the Tcl parameter syntax -/cls/ info parameter syntax ?name? +/obj/ info lookup slots \ + ?-type ...? ?-source ... ?pattern? + +# Obtain definition, name or parameter from +# slot object + +/slotobj/ definition +/slotobj/ name +/slotobj/ parameter ---------------- |====================== @@ -2328,117 +2273,60 @@ |[source,tcl] ---------------- /obj/ info filter ?-guards? ?-order? ?pattern? +/obj/ info filterguard /name/ ---------------- |[source,tcl] ---------------- # ... info filter methods -order ... returns # method-handles instead of triples # (applies to all three variants) -/obj/ info filter methods \ +/obj/ info object filter methods \ ?-guards? ?-order? ?pattern? +/obj/ info object filter guard /name/ ---------------- |[source,tcl] ---------------- -/obj/ info filterguard /name/ ----------------- -|[source,tcl] ----------------- -/obj/ info filter guard /name/ ----------------- -|[source,tcl] ----------------- -/cls/ info filter ?-guards? ?-order? ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ class info filter methods \ - ?-guards? ?-order? ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ info filterguard /name/ ----------------- -|[source,tcl] ----------------- -/cls/ class info filter guard /name/ ----------------- -|[source,tcl] ----------------- /cls/ info instfilter \ ?-guards? ?-order? ?pattern? +/cls/ info instfilterguard /name/ ---------------- |[source,tcl] ---------------- /cls/ info filter methods \ ?-guards? ?-order? ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ info instfilterguard /name/ ----------------- -|[source,tcl] ----------------- /cls/ info filter guard /name/ ---------------- |[source,tcl] ---------------- /obj/ info mixin ?-guards? ?-order? ?pattern? ----------------- -|[source,tcl] ----------------- -/obj/ info mixin classes \ - ?-guards? ?-heritage? ?pattern? ----------------- -|[source,tcl] ----------------- /obj/ info mixinguard /name/ ---------------- |[source,tcl] ---------------- -/obj/ info mixin guard /name/ ----------------- -|[source,tcl] ----------------- -/cls/ info mixin ?-guards? ?-order? ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ class info mixin classes \ +/obj/ info object mixin classes \ ?-guards? ?-heritage? ?pattern? +/obj/ info object mixin guard /name/ ---------------- |[source,tcl] ---------------- -/cls/ info mixinguard /name/ ----------------- -|[source,tcl] ----------------- -/cls/ class info mixin guard /name/ ----------------- -|[source,tcl] ----------------- /cls/ info instmixin \ ?-guards? ?-order? ?pattern? +/cls/ info instmixinguard /name/ ---------------- |[source,tcl] ---------------- /cls/ info mixin classes \ ?-closure? ?-guards? ?-heritage? ?pattern? ----------------- -|[source,tcl] ----------------- -/cls/ info instmixinguard /name/ ----------------- -|[source,tcl] ----------------- /cls/ info mixin guard /name/ ---------------- |====================== ==== List definition of methods defined by aliases, setters or forwarders As mentioned earlier, +info method definition+ can be used on every -kind of method. +kind of method. The same call can be used to obtain the definition of +a scripted method, a method-alias, a forwarder or a setter method. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== @@ -2450,8 +2338,8 @@ ---------------- |[source,tcl] ---------------- -/obj/ info method definition /methodName/ -/cls/ ?class? info method definition /methodName/ +/cls/ info method definition /methodName/ +/obj/ info object method definition /methodName/ ---------------- |====================== @@ -2478,29 +2366,29 @@ # can be used e.g. for aliases. "handle" is the short # form of "definitionhandle". # -/obj/ info method handle /methodName/ -/cls/ ?class? info method handle /methodName/ +/cls/ info method handle /methodName/ +/obj/ info object method handle /methodName/ # # For ensemble methods (method name contains # spaces) one can query as well the registration # handle, which is the handle to the root of the # ensemble; the definiton handle points to the # leaf of the ensemble. # -/obj/ info method registrationhandle /methodName/ -/cls/ ?class? info method registrationhandle /methodName/ +/cls/ info method registrationhandle /methodName/ +/obj/ info object method registrationhandle /methodName/ # # For aliases, one can query the original definition # via "info method origin" # -/obj/ info method origin /methodName/ -/cls/ ?class? info method origin /methodName/ +/cls/ info method origin /methodName/ +/obj/ info object method origin /methodName/ ---------------- |====================== ==== List type of a method -The method +info method type+ is new in NX to obtain the type of the +The method +info ?object? method type+ is new in NX to obtain the type of the specified method. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] @@ -2513,16 +2401,9 @@ ---------------- |[source,tcl] ---------------- -/obj/ info method type /methodName/ +/cls/ info method type /methodName/ +/obj/ info object method type /methodName/ ---------------- -|[source,tcl] ----------------- -# n.a. ----------------- -|[source,tcl] ----------------- -/cls/ ?class? info method type /methodName/ ----------------- |====================== ==== List the scope of mixin classes @@ -2606,17 +2487,25 @@ ---------------- |[source,tcl] ---------------- -# Check if object is a class -/obj/ info is class +cd # Check if object is an NX class +/obj/ has type ::nx::Class + +# Check if object is a class in one of the +# NSF object systems +::nsf::is class /obj/ ---------------- |[source,tcl] ---------------- /obj/ ismetaclass /cls/ ---------------- |[source,tcl] ---------------- -# Check if object is a metaclass -/obj/ info is metaclass +# Check if class is an NX metaclass +expr {[/cls/ info heritage ::nx::Class] ne ""} + +# Check if object is a metaclass in one of the +# NSF object systems +::nsf::is metaclass /obj/ ---------------- |[source,tcl] ---------------- @@ -2625,7 +2514,7 @@ |[source,tcl] ---------------- # Check if object is a baseclass of an object system -/obj/ info is baseclass +::nsf::is baseclass /obj/ ---------------- |[source,tcl] ---------------- @@ -2740,7 +2629,8 @@ ---------------- |[source,tcl] ---------------- -# Returns method-handle +# Returns method-handle of the +# method to be called via "next" current next ---------------- |[source,tcl] @@ -2749,7 +2639,8 @@ ---------------- |[source,tcl] ---------------- -# Returns method-handle +# Returns method-handle of the +# filter method current filterreg ---------------- |[source,tcl] @@ -2815,7 +2706,7 @@ ---------------- |[source,tcl] ---------------- -::nsf::method::assertion /obj/ check /checkptions/ +::nsf::method::assertion /obj/ check /checkoptions/ ---------------- |[source,tcl] ----------------