# Methods for defining methods: -# -# alias -# forward -# method -# -# All these methods return method-handles.
Index: doc/next-migration.html =================================================================== diff -u -rd8b8fec1b9c4b2ab7c1cc36c156649109ca0807a -rd303212e06bfd89c57038a26ba54f9f86e941601 --- doc/next-migration.html (.../next-migration.html) (revision d8b8fec1b9c4b2ab7c1cc36c156649109ca0807a) +++ doc/next-migration.html (.../next-migration.html) (revision d303212e06bfd89c57038a26ba54f9f86e941601) @@ -858,7 +858,7 @@
-One can define in NX hierachical method names (similar to +One can define in NX hierarchical method names (similar to commands and subcommands, called method ensembles) in a convenient way to provide extensible, hierarchical naming of methods. @@ -1003,7 +1003,7 @@
Much Smaller Interface: The Next Scripting Language has a much smaller interface (i.e. provides less predefined methods) than - XOTcl (see Table 1), although the expressability was increased in + XOTcl (see Table 1), although the expressiveness was increased in NX.
Class create Stack { - # - # Stack of Things - # + # + # Stack of Things + # :variable things "" :public method push {thing} { - set :things [linsert ${:things} 0 $thing] - return $thing + set :things [linsert ${:things} 0 $thing] + return $thing } :public method pop {} { - set top [lindex ${:things} 0] - set :things [lrange ${:things} 1 end] - return $top + set top [lindex ${:things} 0] + set :things [lrange ${:things} 1 end] + return $top } }
# -# Stack of Things -# +# +# Stack of Things +# Class Stack @@ -1144,14 +1144,14 @@ Stack instproc push {thing} { my instvar things - set things [linsert $things 0 $thing] - return $thing + set things [linsert $things 0 $thing] + return $thing } Stack instproc pop {} { my instvar things - set top [lindex $things 0] - set things [lrange $things 1 end] + set top [lindex $things 0] + set things [lrange $things 1 end] }
In general, the Next Scripting Framework supports multiple object systems concurrently. Effectively, every object system has different base classes for creating objects and classes. Therefore, these object -systems can have different different interfaces and names of built-in +systems can have different interfaces and names of built-in methods. Currently, the Next Scripting Framework is packaged with three object systems:
# Define instance method 'foo' and object -# method 'bar' for a Class 'C' with separate -# toplevel commands +# Define instance method 'foo' and object +# method 'bar' for a Class 'C' with separate +# toplevel commands Class C C instproc foo args {...} @@ -1386,8 +1386,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define instance method and object method -# in the init-block of a class +# Define instance method and object method +# in the init-block of a class Class create C { :method foo args {...} @@ -1404,8 +1404,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define instance method and object method -# with separate commands +# Define instance method and object method +# with separate commands Class create C C method foo args {...} @@ -1423,8 +1423,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define object-specific method foo -# for an object 'o' with separate commands +# Define object-specific method foo +# for an object 'o' with separate commands Object o o set x 1 @@ -1440,9 +1440,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define object method and set -# instance variable in the init-block of -# an object +# Define object method and set +# instance variable in the init-block of +# an object Object create o { set :x 1 @@ -1459,9 +1459,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define object method and set -# instance variable with separate -# commands +# Define object method and set +# instance variable with separate +# commands Object create o o eval {set :x 1} @@ -1502,16 +1502,16 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Methods for defining methods: -# -# proc -# instproc -# forward -# instforward -# parametercmd -# instparametercmd -# -# All these methods return empty.
# Methods for defining methods: +# +# proc +# instproc +# forward +# instforward +# parametercmd +# instparametercmd +# +# All these methods return empty.
# Methods for defining methods: -# -# alias -# forward -# method -# -# All these methods return method-handles.
# Methods for defining methods: +# +# alias +# forward +# method +# +# All these methods return method-handles.@@ -1541,7 +1541,7 @@ parameters are defined (see Section 3.4).
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
+XOTcl, but use internally the Next Scripting Framework primitive
nsf::method::setter
when appropriate.
- # Define method aliases -# (to scripted or non-scripted methods) +# Define method aliases +# (to scripted or non-scripted methods) Class create C { :alias a1 ... @@ -1740,14 +1740,14 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Method modifiers -# -# "object", -# "public", -# "protected", and -# "private" -# -# are not available |
+
- # Method modifiers -# -# "object", -# "public", -# "protected" -# -# are applicable for all kinds of -# method defining methods: -# -# method, forward, alias -# -# The modifier "private" is available for -# -# method, forward, alias -# +# Method modifiers +# +# "object", +# "public", +# "protected" +# +# are applicable for all kinds of +# method defining methods: +# +# method, forward, alias +# +# The modifier "private" is available for +# +# method, forward, alias +# Class create C { :/method-definiton-method/ ... :public /method-definiton-method/ ... @@ -1824,8 +1824,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# XOTcl provides no means for -# method hiding |
+
- # Hiding of methods via "private" -# +# Hiding of methods via "private" +# nx::Class create Base { - :private method baz {a b} {expr {$a + $b}} - :public method foo {a b} {: -local baz $a $b} + :private method baz {a b} {expr {$a + $b}} + :public method foo {a b} {: -local baz $a $b} } nx::Class create Sub -superclass Base { - :public method bar {a b} {: -local baz $a $b} - :private method baz {a b} {expr {$a * $b}} + :public method bar {a b} {: -local baz $a $b} + :private method baz {a b} {expr {$a * $b}} :create s1 } -s1 foo 3 4 ;# returns 7 -s1 bar 3 4 ;# returns 12 -s1 baz 3 4 ;# unable to dispatch method 'baz' |
+s1 foo 3 4 ;# returns 7
+s1 bar 3 4 ;# returns 12
+s1 baz 3 4 ;# unable to dispatch method 'baz'
# XOTcl provides only method deletion with -# the equivalent of Tcl's "proc foo {} {}" +# XOTcl provides only method deletion with +# the equivalent of Tcl's "proc foo {} {}" /cls/ instproc foo {} {} /obj/ proc foo {} {}
# Deletion of Methods -# +# Deletion of Methods +# /cls/ delete method /name/ /obj/ delete object method /name/
Class C C instproc foo args {...} C instproc bar args { - my foo 1 2 3 ;# invoke own method - o baz ;# invoke other object's method + my foo 1 2 3 ;# invoke own method + o baz ;# invoke other object's method } Object o o proc baz {} {...}@@ -1979,8 +1979,8 @@
Class create C { :method foo args {...} :method bar args { - :foo 1 2 3 ;# invoke own method - o baz ;# invoke other object's method + :foo 1 2 3 ;# invoke own method + o baz ;# invoke other object's method } } Object create o { @@ -2054,12 +2054,12 @@Class C C instproc foo args { - # Method scoped variable a + # Method scoped variable a set a 1 - # Instance variable b + # Instance variable b my instvar b set b 2 - # Global variable/namespaced variable c + # Global variable/namespaced variable c set ::c 3 }@@ -2110,8 +2110,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - @@ -2075,11 +2075,11 @@Class create C { :method foo args {...} - # Method scoped variable a + # Method scoped variable a set a 1 - # Instance variable b + # Instance variable b set :b 2 - # Global variable/namespaced variable c + # Global variable/namespaced variable c set ::c 3 } }# Set own instance variable to a value via -# resolver (preferred and fastest way) +# Set own instance variable to a value via +# resolver (preferred and fastest way) ... method ... { set :/newVar/ ?value? @@ -2144,8 +2144,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Set own instance variable via -# variable import +# Set own instance variable via +# variable import ... method ... { ::nx::var import [self] /varName/ @@ -2178,7 +2178,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Read own instance variable +# Read own instance variable ... method ... { set /varName/ [set :/otherVar/] @@ -2195,7 +2195,7 @@ .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}... method ... { - set /newVar/ ${:/otherVar/} + set /newVar/ ${:/otherVar/} }@@ -2224,7 +2224,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - @@ -2318,8 +2318,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Test existence of own instance variable +
# Test existence of own instance variable ... method ... { info :/varName/ @@ -2288,9 +2288,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Set instance variable of object obj to a -# value via resolver -# (preferred way: define property on obj) +# Set instance variable of object obj to a +# value via resolver +# (preferred way: define property on obj) /obj/ eval [list set :/varName/ ?value?]# Read instance variable of object obj -# via resolver +# Read instance variable of object obj +# via resolver set /varName/ [/obj/ eval {set :/otherVar/}]@@ -2350,8 +2350,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Read instance variable of object /obj/ -# via import +# Read instance variable of object /obj/ +# via import ... method ... { ::nx::var import /obj/ /varName/ @@ -2382,8 +2382,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -@@ -2552,7 +2552,7 @@ 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. +operations in constructors, this is as well possible in NX.# Test existence of instance variable of -# object obj +# Test existence of instance variable of +# object obj /obj/ eval {info exists :/varName/}@@ -2494,10 +2494,10 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -+# Object f1 has instance variables +# x == 1 and y == 2# Define class "Foo" with instance -# variables "x" and "y" initialized -# on instance creation. The initialization -# has to be performed in the constructor. +# 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 { @@ -2506,11 +2506,11 @@ set y 2 } -# Create instance of the class Foo +# Create instance of the class Foo Foo f1 -# Object f1 has instance variables -# x == 1 and y == 2+# Object f1 has instance variables +# x == 1 and y == 2 -# 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 -# instance creation, the variable -# definitions are used for the -# initialization of the variables of the object. +# 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 +# instance creation, the variable +# definitions are used for the +# initialization of the variables of the object. Class create Foo { :variable x 1 :variable y 2 } -# Create instance of the class Foo +# Create instance of the class Foo Foo create f1 -# Object f1 has instance variables -# x == 1 and y == 2NX uses the same mechanism to define class variables or object variables.
@@ -2581,8 +2581,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -+# No syntactic support for creating -# class variables# No syntactic support for creating +# class variables -# 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". +# 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 { :object variable V 100 @@ -2612,8 +2612,8 @@In the next step, we define configurable instance variables which we call properties in NX.
@@ -2662,25 +2662,25 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -XOTcl uses the method
parameter
is a shortcut for creating multiple -configurable variables with automically created accessors (methods for -reading and writing of the variables). In NX, the prefered way to +configurable variables with automatically created accessors (methods for +reading and writing of the variables). In NX, the preferred way to create configurable variables is to use the methodproperty
. The methodproperty
in NX is similar tovariable
, but makes the variables configurable, which means that# Parameters specified as a list -# (short form); parameter -# "a" has no default, "b" has default "1" +# Parameters specified as a list +# (short form); parameter +# "a" has no default, "b" has default "1" Class Foo -parameter {a {b 1}} -# Create instance of the class Foo +# Create instance of the class Foo Foo f1 -a 0 -# Object f1 has instance variables -# a == 0 and b == 1 +# 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" +# 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" +# Use the setter to alter value of +# instance variable "b" f1 b 100@@ -2751,23 +2751,23 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - -# Define property "a" and "b". The -# property "a" has no default, "b" has -# default value "1" +# Define property "a" and "b". The +# property "a" has no default, "b" has +# default value "1" Class create Foo { :property a :property {b 1} } -# Create instance of the class Foo +# Create instance of the class Foo Foo create f1 -a 0 -# Object f1 has instance variables -# a == 0 and b == 1 +# Object f1 has instance variables +# a == 0 and b == 1 -# Use the method "cget" to query the value -# of a configuration parameter +# 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" +# Use the method "configure" to alter the +# value of instance variable "b" f1 configure -b 100# "parameter" creates always accessor -# methods, accessor methods are -# always public, no "cget" is available. +# "parameter" creates always accessor +# methods, accessor methods are +# always public, no "cget" is available. Class create Foo -parameter {a {b1}} -# Use the accessor method to query -# the value of a configuration parameter +# 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" +# Use the accessor method to set the +# value of instance variable "a" f1 a 100 -# Use the accessor method to unset the -# value of instance variable "a" n.a. via -# accessor+# Use the accessor method to unset the +# value of instance variable "a" n.a. via +# accessor@@ -2831,9 +2831,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - -# Define property "a" and "b". The -# property "a" has no default, "b" has -# default value "1" +# Define property "a" and "b". The +# property "a" has no default, "b" has +# default value "1" Class create Foo { :variable -accessor public a :property -accessor public {b 1} } -# Use the accessor method to query -# the value of a configuration parameter +# Use the accessor method to query +# the value of a configuration parameter puts [f1 b get] -# Use the accessor method to set the -# value of instance variable "a" +# Use the accessor method to set the +# value of instance variable "a" f1 a set 100 -# Use the accessor method to unset the -# value of instance variable "a" +# Use the accessor method to unset the +# value of instance variable "a" f1 a unset# XOTcl provides no means to define -# configurable variables at the object -# level+# XOTcl provides no means to define +# configurable variables at the object +# level+ -# Define class with a property for the class object -# named "cp". This is similar to "static variables" -# in some other object-oriented programming -# languages. +# 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 Foo { ... :object property cp 101 } -# Define object property "op" +# Define object property "op" Object create o { :object property op 102 @@ -2897,8 +2897,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# No value constraints for -# parameter available# No value constraints for +# parameter available+ -# Predefined value constraints: -# object, class, alnum, alpha, ascii, boolean, -# control, digit, double, false, graph, integer, -# lower, parameter, print, punct, space, true, -# upper, wordchar, xdigit -# -# User defined value constraints are possible. -# All parameter value checkers can be turned on -# and off at runtime. -# -# Define a required boolean property "a" -# and an integer property "b" with a default. -# The first definition uses "properties", -# the second definition uses multiple -# "property" statements. +# Predefined value constraints: +# object, class, alnum, alpha, ascii, boolean, +# control, digit, double, false, graph, integer, +# lower, parameter, print, punct, space, true, +# upper, wordchar, xdigit +# +# User defined value constraints are possible. +# All parameter value checkers can be turned on +# and off at runtime. +# +# Define a required boolean property "a" +# and an integer property "b" with a default. +# The first definition uses "properties", +# the second definition uses multiple +# "property" statements. Class create Foo -properties { a:boolean @@ -2953,7 +2953,7 @@ to be passed to the constructor of the object.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 +as the single mechanism to parametrize objects. It is in NX not necessary (and per default not possible) to pass arguments to the constructor.
@@ -2982,7 +2982,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Required parameter not available
# Required parameter not available
+ -# Required parameter: -# Define a required property "a" and a -# required boolean property "b" +# Required parameter: +# Define a required property "a" and a +# required boolean property "b" Class create Foo -properties { a:required @@ -3053,8 +3053,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Multiplicity for parameter -# not available# Multiplicity for parameter +# not available+# Object f1 has a == 0 and b == 1 -# Parameter with multiplicity -# ints is a list of integers, with default -# objs is a non-empty list of objects -# obj is a single object, maybe empty +# Parameter with multiplicity +# ints is a list of integers, with default +# objs is a non-empty list of objects +# obj is a single object, maybe empty Class create Foo -properties { {ints:integer,0..n ""} @@ -3148,19 +3148,19 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define parameters via slots +
# 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" +# 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+# Object f1 has a == 0 and b == 1 -# Configurable parameters specified via the -# method "property" (supports method -# modifiers and scripted configuration; -# see below) +# 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" +# 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 +parametrized 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 @@ -3223,13 +3223,13 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Define parameter with an an -# attribute-specific type checker +# 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 { + switch -glob $value { m* {return m} f* {return f} default { @@ -3250,16 +3250,16 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Configure parameter with scripted -# definition (init-block), defining a -# property specific type checker +# Configure parameter with scripted +# definition (init-block), defining a +# property specific type checker Class create Person { :property -accessor public sex:sex,convert { - # define a converter to standardize representation + # define a converter to standardize representation :object method type=sex {name value} { - switch -glob $value { + switch -glob $value { m* {return m} f* {return f} default {error "expected sex but got $value"} @@ -3305,8 +3305,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# No syntactic support for deleting -# variable handlers# No syntactic support for deleting +# variable handlers -# Like deletion of Methods: -# Delete on the object, where the -# variable handler is defined. +# Like deletion of Methods: +# Delete on the object, where the +# variable handler is defined. /cls/ delete property /name/ /obj/ delete object property /name/ @@ -3368,9 +3368,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Define method foo with non-positional -# parameters (x, y and y) and positional -# parameter (a and b) +# Define method foo with non-positional +# parameters (x, y and y) and positional +# parameter (a and b) Class C C instproc foo { @@ -3380,11 +3380,11 @@ a b } { - # ... + # ... } C create c1 -# invoke method foo +# invoke method foo c1 foo -x 1 -y a 2 3 -# Define method foo with -# non-positional parameters -# (x, y and y) and positional -# parameter (a and b) +# Define method foo with +# non-positional parameters +# (x, y and y) and positional +# parameter (a and b) Class create C { :public method foo { @@ -3410,11 +3410,11 @@ a b } { - # ... + # ... } :create c1 } -# invoke method foo +# invoke method foo c1 foo -x 1 -y a 2 3@@ -3429,12 +3429,12 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - @@ -3518,8 +3518,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# 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, ... -# Define various forms of parameters -# not available in XOTcl 1 +# Define various forms of parameters +# not available in XOTcl 1 Class create C { - # trailing (or interleaved) non-positional - # parameters + # trailing (or interleaved) non-positional + # parameters :public method m1 {a b -x:integer -y} { - # ... + # ... } - # positional parameters with value constraints + # positional parameters with value constraints :public method m2 {a:integer b:boolean} { - #... + #... } - # optional positional parameter (trailing) + # optional positional parameter (trailing) :public method set {varName value:optional} { - # .... + # .... } - # parameter with multiplicity + # parameter with multiplicity :public method m3 {-objs:object,1..n c:class,0..1} { - # ... + # ... } - # In general, the same list of value - # constraints as for configure parameter is - # available (see above). - # - # User defined value constraints are - # possible. All parameter value checkers - # can be turned on and off. + # In general, the same list of value + # constraints as for configure parameter is + # available (see above). + # + # User defined value constraints are + # possible. All parameter value checkers + # can be turned on and off. }# No return value checking -# available+# No return value checking +# available -+the modifier# Define method foo with non-positional -# parameters (x, y and y) and positional -# parameter (a and b) +# Define method foo with non-positional +# parameters (x, y and y) and positional +# parameter (a and b) Class create C { - # Define method foo which returns an - # integer value + # Define method foo which returns an + # integer value :method foo -returns integer {-x:integer} { - # ... + # ... } - # Define an alias for the Tcl command ::incr - # and assure, it always returns an integer - # value + # Define an alias for the Tcl command ::incr + # and assure, it always returns an integer + # value :alias incr -returns integer ::incr - # Define a forwarder that has to return an - # integer value + # Define a forwarder that has to return an + # integer value :forward ++ -returns integer ::expr 1 + - # Define a method that has to return a - # non-empty list of objects + # Define a method that has to return a + # non-empty list of objects :public object method instances {} \ -returns object,1..n { return [:info instances] @@ -3571,7 +3571,7 @@ 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 names of instance specific method, but uses -the the modifierobjec
" for object specific methods.object
" for object specific 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 andobject mixin
is registered, it is a per-object mixin. In both cases, the @@ -3609,7 +3609,7 @@/cls/ instmixin ... /cls/ instmixinguard /mixin/ ?condition? -# Query per-class mixin +# Query per-class mixin /cls/ instmixin -# Register/clear per-class mixin and guard for -# a class +# Register/clear per-class mixin and guard for +# a class /cls/ mixins add|set|clear ... /cls/ mixins guard /mixin/ ?condition? /cls/ configure -mixin ... -# Query per-class mixins +# Query per-class mixins /cls/ mixins get /cls/ cget -mixins -# Query per-class mixins (without guards) +# Query per-class mixins (without guards) /cls/ mixins classes@@ -3651,7 +3651,7 @@ @@ -3710,12 +3710,12 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -/obj/ mixin ... /obj/ mixinguard /mixin/ ?condition? -# Query per-object mixins +# Query per-object mixins /obj/ mixin -# Register/clear per-object mixin and guard for -# an object +# Register/clear per-object mixin and guard for +# an object /obj/ object mixins add|set|clear ... /obj/ object mixins guard /mixin/ ?condition? /obj/ configure -object-mixins ... -# Query per-object mixin +# Query per-object mixin /obj/ object mixins get /obj/ cget -object-mixin -# Query per-object mixins (without guards) +# Query per-object mixins (without guards) /cls/ mixins classes# Register per-class filter and guard for -# a class +# Register per-class filter and guard for +# a class /cls/ instfilter ... /cls/ instfilterguard /filter/ ?condition? -# Query per-class filter +# Query per-class filter /cls/ instfilter -# Register/clear per-class filter and guard for -# a class +# Register/clear per-class filter and guard for +# a class /cls/ filters add|set|clear ... /cls/ filters guard /filter/ ?condition? /cls/ configure -filters ... -# Query per-class filters +# Query per-class filters /cls/ filters get /cls/ cget -filters -# Query per-class filters (without guards) +# Query per-class filters (without guards) /cls/ filters methods@@ -3767,18 +3767,18 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - @@ -3795,7 +3795,7 @@# Register(clear per-object filter and guard for -# an object +# Register(clear per-object filter and guard for +# an object /obj/ object filters add|set|clear ... /obj/ object filters guard /filter/ ?condition? /obj/ configure -object-filters ... -# Query per-object filters +# Query per-object filters /cls/ object filters get /obj/ cget -object-filters -# Query per-object filters (without guards) +# Query per-object filters (without guards) /cls/ object filters methods+In NX, one can use e.g. always
info method
with a subcommand and the framework tries to hide the differences as far as possible. So, one can for example obtain withinfo method parameter
the parameters of -scripted and C-implemented methods the same way, one one can get the +scripted and C-implemented methods the same way, one can get the definition of all methods viainfo method definition
and one can get an manual-like interface description viainfo method syntax
. In addition, NX provides means to query the type of @@ -3985,7 +3985,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# n.a.
+ -# n.a.
# n.a.
+# Returns list of method names /obj/ info lookup methods ... ?pattern? -# Returns list of method names+ @@ -4254,7 +4254,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# n.a.
+# Returns list of method names -# List only application specific methods +
# List only application specific methods /obj/ info lookup methods -source application ... ?pattern? -# Returns list of method names+ @@ -4282,10 +4282,10 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Options for 'info methods' -# -# -incontext -# -nomixins# Options for 'info methods' +# +# -incontext +# -nomixins+ -# Options for 'info lookup methods' -# -# -source ... -# -callprotection ... -# -incontext -# -type ... -# -nomixins# Options for 'info lookup methods' +# +# -source ... +# -callprotection ... +# -incontext +# -type ... +# -nomixins+ @@ -4317,7 +4317,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# n.a.
+# Returns list of slot objects -# List slot objects defined for obj -# -source might be all|application|baseclasses -# -type is the class of the slot object +# List 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@@ -4422,7 +4422,7 @@ .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} @@ -4349,10 +4349,10 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# List registered filters +
# List registered filters /obj/ info filters -order ?-guards? ?pattern? -# List registered mixins +# List registered mixins /obj/ info mixins -heritage ?-guards? ?pattern? -# List registered filters +
# List registered filters /obj/ info lookup filters ?-guards? ?pattern? -# List registered mixins +# List registered mixins /obj/ info lookup mixins ?-guards? ?pattern?/obj/ info lookup method /methodName/ -# Returns method-handle+# Returns method-handle@@ -4495,7 +4495,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - +# Returns method-handle @@ -4449,7 +4449,7 @@ .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}/obj/ info lookup filter /methodName/ -# Returns method-handle# n.a.
+# n.a.
+ -# not needed, part of -# "info ?object? method parameter"# not needed, part of +# "info ?object? method parameter"@@ -5235,7 +5235,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - + @@ -4711,7 +4711,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# n.a.
+ -# n.a.
# n.a.
-# Return the parameters applicable to -# the create method of a certain class. -# class can be configured. A pattern can -# be used to filter the results. +# Return the parameters applicable to +# the create method of a certain class. +# class can be configured. A pattern can +# be used to filter the results. /cls/ info lookup parameters create ?/pattern/? -# Return in the result in documentation syntax +# Return in the result in documentation syntax /cls/ info lookup syntax create ?/pattern/? -# "info lookup parameters configure" returns -# parameters available for configuring the -# current object (might contain object -# specific information) +# "info lookup parameters configure" returns +# parameters available for configuring the +# current object (might contain object +# specific information) /obj/ info lookup parameters configure ?pattern? -# "info lookup configure syntax" returns syntax of -# a call to configure in the Tcl parameter syntax +# "info lookup configure syntax" returns syntax of +# a call to configure in the Tcl parameter syntax /obj/ info lookup syntax configure -# Obtain information from a parameter -# (as e.g. returned from "info lookup -# parameters configure"). +# Obtain information from a parameter +# (as e.g. returned from "info lookup +# parameters configure"). nsf::parameter::info name /parameter/ nsf::parameter::info syntax /parameter/ @@ -4838,8 +4838,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# obtain parameter definitions defined -# for a class +# obtain parameter definitions defined +# for a class /cls/ info parameter+ -# "info variables" returns handles of -# properties and variables defined by this -# class or object +# "info variables" returns handles of +# properties and variables defined by this +# class or object /cls/ info variables ?pattern? /obj/ info object variables ?pattern? -# "info lookup variables" returns handles -# of variables and properties applicable -# for the current object (might contain -# object specific information) +# "info lookup variables" returns handles +# of variables and properties applicable +# for the current object (might contain +# object specific information) /obj/ info lookup variables /pattern/ -# "info variable" lists details about a -# single property or variable. +# "info variable" lists details about a +# single property or variable. /obj/ info variable definition /handle/ /obj/ info variable name /handle/ @@ -4905,7 +4905,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# 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 +# 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 /cls/ info slots \ ?-type value? ?-closure? ?-source value? ?pattern? /obj/ info object slots ?-type ...? ?pattern? -# 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. +# 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. /obj/ info lookup slots \ ?-type ...? ?-source ... ?pattern? -# Obtain definition, name or parameter from -# slot object +# Obtain definition, name or parameter from +# slot object /slotobj/ definition /slotobj/ name @@ -5115,7 +5115,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
# n.a.
+ -# n.a.
# n.a.
-# -# List the method handle of the specified method, -# can be used e.g. for aliases. "handle" is the short -# form of "definitionhandle". -# +# +# List the method handle of the specified method, +# can be used e.g. for aliases. "handle" is the short +# form of "definitionhandle". +# /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. -# +# +# 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. +# /cls/ info method registrationhandle /methodName/ /obj/ info object method registrationhandle /methodName/ -# -# For aliases, one can query the original -# definition via "info method origin" -# +# +# For aliases, one can query the original +# definition via "info method origin" +# /cls/ info method origin /methodName/ /obj/ info object method origin /methodName/# n.a.
+# n.a.
@@ -5326,7 +5326,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - -# List objects, where /cls/ is a -# per-object mixin +# List objects, where /cls/ is a +# per-object mixin /cls/ info mixinof -scope object ?-closure? \ ?pattern?# List classes, where /cls/ is a per-class mixin +# List classes, where /cls/ is a per-class mixin /cls/ info mixinof -scope class ?-closure? \ ?pattern?@@ -5343,7 +5343,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# n.a.
+# n.a.
@@ -5419,7 +5419,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} --# List objects and classes, where /cls/ is -# either a per-object or a per-class mixin +# List objects and classes, where /cls/ is +# either a per-object or a per-class mixin /cls/ info mixinof -scope all ?-closure? \ ?pattern?# Check if object is a subtype of some class +
# Check if object is a subtype of some class /obj/ info has type /sometype/@@ -5446,7 +5446,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # Check if object has the specified mixin registered +
# Check if object has the specified mixin registered /obj/ info has mixin /cls/@@ -5473,11 +5473,11 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # Check if object is an NX class +
# 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 +# Check if object is a class in one of the +# NSF object systems ::nsf::is class /obj/@@ -5504,11 +5504,11 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # Check if class is an NX 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 +# Check if object is a metaclass in one of the +# NSF object systems ::nsf::is metaclass /obj/@@ -5523,7 +5523,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # n.a.
+# n.a.
-# Check if object is a baseclass of an object system +
# Check if object is a baseclass of an object system ::nsf::is baseclass /obj/@@ -5550,7 +5550,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # n.a.
+# n.a.
-# Return name of object (without namespace prefix) +
# Return name of object (without namespace prefix) /obj/ info name@@ -5589,7 +5589,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - @@ -5912,8 +5912,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# Check for existence of object (nsf primitive) +
# Check for existence of object (nsf primitive) ::nsf::object::exists /obj/# Returns method-handle of the -# method to be called via "next" +# Returns method-handle of the +# method to be called via "next" current next@@ -5940,8 +5940,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # Returns method-handle of the -# filter method +# Returns method-handle of the +# filter method current filterreg@@ -6055,7 +6055,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} - # n.a.
+# n.a.
@@ -6374,7 +6374,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} --# XOTcl example +
# XOTcl example Class Foo -parameter {x y} Foo f1 -x -y 1# XOTcl example +
# XOTcl example Class Foo -parameter {{x 1}} Class Bar -superclass Foo -parameter x @@ -6398,12 +6398,12 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# NX example +
# NX example nx::Class create Foo Foo create f1 -# now alter the class of object f1 +# now alter the class of object f1 nsf::relation::set f1 class ::nx::Object@@ -6432,7 +6432,7 @@@@ -6466,7 +6466,7 @@3.4. Obsolete Commands
Parameter-classes were rarely used and have been replaced by the more -general object parameterization. Therefore,
cl info parameterclass
has +general object parametrization. Therefore,cl info parameterclass
has been removed.@@ -6456,7 +6456,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -# NX example +
# NX example ::nsf::exithandler set|get|unset ?arg?