Index: ChangeLog-2.0.0-2.1.0.log =================================================================== diff -u -r0de05aaed50fced1cd80a9408560a38fb2454bcf -r2a955681817e4db4776d7ae904babe8053c5ad74 --- ChangeLog-2.0.0-2.1.0.log (.../ChangeLog-2.0.0-2.1.0.log) (revision 0de05aaed50fced1cd80a9408560a38fb2454bcf) +++ ChangeLog-2.0.0-2.1.0.log (.../ChangeLog-2.0.0-2.1.0.log) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -2,8 +2,7 @@ * nsfmongo.c: Added explicit calls to mongoc_init() and mongoc_cleanup(). Documented use of configure flag - "--disable-automatic-init-and-cleanup" to avoid crashes under Mac - OS X. [b7029a4] + "--disable-automatic-init-and-cleanup" to avoid crashes under macOS. [b7029a4] * nxsh.man: Improved wording. [a7ce921] @@ -450,7 +449,7 @@ 2016-09-29 Stefan Sobernig * nsf.c, methods.test (DispatchUnknownMethod): Make sure that - arcane method names make it into proper unknown error mesages + arcane method names make it into proper unknown error messages incl. names representing invalid Tcl lists; tests included; checked by valgrind [4b78042] @@ -632,7 +631,7 @@ adding const declarations, preferring boolean tests, avoid "for" loops without a block, don't pass non-initialized value in an array on index [0], reducing variable scope, preferring single - returns statements in functions, dont't use CONST unless defined + returns statements in functions, don't use CONST unless defined by Tcl API. [8eecbe5] * nsf.c: Limit effects of namespace-imported classes. [3b5f62d] @@ -1398,7 +1397,7 @@ * Makefile.in: Make sure to rm .o files in stub directory. [4f7f7c1] - * mktar.sh: Make sure to omit Mac OS X hidden file from tarballs. + * mktar.sh: Make sure to omit macOS hidden file from tarballs. [9fe4a51] 2014-12-04 Gustaf Neumann Index: ChangeLog-2.0b3-2.0b5.log =================================================================== diff -u -r5bdfdb70f7570bda409acd24efbdc7e73b908c6b -r2a955681817e4db4776d7ae904babe8053c5ad74 --- ChangeLog-2.0b3-2.0b5.log (.../ChangeLog-2.0b3-2.0b5.log) (revision 5bdfdb70f7570bda409acd24efbdc7e73b908c6b) +++ ChangeLog-2.0b3-2.0b5.log (.../ChangeLog-2.0b3-2.0b5.log) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -126,7 +126,7 @@ - changed multiplicity of mixin, object-mixin, filter, object-filter from 1..n to 0..n; rationale: when one has a - list of eg. mixins, which should be passed, one has to test + list of e.g. mixins, which should be passed, one has to test for the length before passing it, otherwise the empty list would generate an error. Allowing 0..n makes the usage simpler and the program shorter. @@ -144,7 +144,7 @@ - replaced functionality of "/obj/ configure" by "/obj/ info configure" to re-enable semantics of the plain configure method, even when called without arguments. "/obj/ info - configure" is actually a convenience method to allow to + configure" is actually a convenience method to allow one to write o1 info configure instead of o1 info lookup configure syntax @@ -184,7 +184,7 @@ - saving "keepcmds" in an associative array named "__cmd(/parameternName)" to allow saving of multiple - parmeters with less name clash danger (when application + parameters with less name clash danger (when application stays away from variables stating with double underscore) nx.tcl: @@ -883,7 +883,7 @@ 2012-09-15 Gustaf Neumann nsf.c: - - fixed parmeter syntax for required nonpos args + - fixed parameter syntax for required nonpos args - deactivate deletion of methods via nsf::object::delete during shutdown to avoid missing slot forwarders called from destructors @@ -935,7 +935,7 @@ the others are defined on demand changes to allow efficient tk/incr tcl compatible configure/cget - - refactored code to allow to parameterize handling of required + - refactored code to allow one to parameterize handling of required flag for parameters - don't flag an error when configure is called on an initialized object (logic: if the object is initialized, @@ -954,7 +954,7 @@ 2012-08-10 Gustaf Neumann - - allow to change title of a scripted document + - allow one to change title of a scripted document - make doc beautifier more robust for invalid lists - use explicit return in tutorial example scripts Index: ChangeLog-2.0b5-2.0.0.log =================================================================== diff -u -r0de05aaed50fced1cd80a9408560a38fb2454bcf -r2a955681817e4db4776d7ae904babe8053c5ad74 --- ChangeLog-2.0b5-2.0.0.log (.../ChangeLog-2.0b5-2.0.0.log) (revision 0de05aaed50fced1cd80a9408560a38fb2454bcf) +++ ChangeLog-2.0b5-2.0.0.log (.../ChangeLog-2.0b5-2.0.0.log) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -70,7 +70,7 @@ - bump version number to 2.0 (also in .man files) - add Changelog for 2.0 release - updated for mongo-c-driver 1.0.2 and MongoDB 2.6.5 - - minor changes were necessary: MongogDB does not allow to delete a + - minor changes were necessary: MongogDB does not allow one to delete a capped collection, one has to use drop - white-space changes - move variable declaration to the front @@ -86,7 +86,7 @@ - reduce number of unused symbols - fix a possible double refcount increment for argument converter (e.g. - for normalizing input values). This could lead to small memory leaks. + for normalizing input values). This could lead too small memory leaks. 2014-10-22 ssoberni @@ -393,7 +393,7 @@ - extended regression test - cleanup, reduce verbosity - minor cleanup - - allow to configure verbosity in test sets + - allow one to configure verbosity in test sets genttclAPI.tcl: - added option "-flags", which can be used for every @@ -789,7 +789,7 @@ - improve handling of space in object names nsfObj.c: - - allow to omit "-guard" within arguments to flag + - allow one to omit "-guard" within arguments to flag definition of a filter/mixin guard - extended regression test @@ -956,7 +956,7 @@ nsf.c: - allow parameter option "method=" for slotassign as well. - rationale: this allows to use the parameter + rationale: this allows one to use the parameter "forwardername" to specify a different forwarder target method (e.g. in case of object-mixins). The method is used both in "configure" and "cget". @@ -1041,7 +1041,7 @@ 2014-05-09 Gustaf Neumann - - finishing checking of first 25% of of nonnull assertions in nsf.c + - finishing checking of first 25% of nonnull assertions in nsf.c - added still more nonnull assertions 2014-05-09 ssoberni @@ -1351,13 +1351,13 @@ - represent BSON_TYPE_REGEX as pairs (regexp + options) in the Tcl representation to preserve regular expression options - - update to newest version of mongo-c-driver and libbson from Github + - update to newest version of mongo-c-driver and libbson from GitHub nx-mongo: - optional support for mongodb connection pools (compile time macro USE_CLIENT_POOL controls this, per default, this is on) - - allow to pass "-metadata" to gridfile::create to ease + - allow one to pass "-metadata" to gridfile::create to ease metadata attachment to grid-files - some convenience improvements in nx-mongo.tcl (ability to ignore attributes in "bson encode", ability to unset @@ -1400,7 +1400,7 @@ nx-monogo: - Updated the mongo-c-driver and libbson to the actual tip - version from Github (this is a significant change, since + version from GitHub (this is a significant change, since 10gen essentially changed the officially supported c-driver of MongoDB) - mongo-c-driver was more or less new-implementation, since @@ -1435,7 +1435,7 @@ - The gridfs interface allows now to store multiple revisions of a file - The gridfs interface allows now upload files from a string - - The gridfs interface allows to refer to files by other + - The gridfs interface allows one to refer to files by other attributes than just the filename (e.g. the mongo id). - Modified/new grid-file functions mongo::gridfile::create ?-source file|string? /gridfs/ /value/ /name/ @@ -1701,7 +1701,7 @@ - explore the usage of dict instead of anonymous array nsf.c: - - dont't use the default of a invocation parameter in + - don't use the default of a invocation parameter in "configure" when the object is already initialized. The default is in general only used when the parameter is not specified. We do not want e.g. superclass to be reset to Index: ChangeLog-2.1.0-2.2.0.log =================================================================== diff -u -rbde09699b9530b531a8dd772d180dc93b10f14b9 -r2a955681817e4db4776d7ae904babe8053c5ad74 --- ChangeLog-2.1.0-2.2.0.log (.../ChangeLog-2.1.0-2.2.0.log) (revision bde09699b9530b531a8dd772d180dc93b10f14b9) +++ ChangeLog-2.1.0-2.2.0.log (.../ChangeLog-2.1.0-2.2.0.log) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -21,7 +21,7 @@ * nsfmongo.c (mongoc_collection_create_index): Removed last deprecated call of the mongo-c-driver [c5e8bf0a] - * doc/Announce2.2.0: Updates to annouce file, tested with + * doc/Announce2.2.0: Updates to announce file, tested with mongo-c-driver 1.12.0 (released yesterday) [b9bcc40a] 2018-07-19 Stefan Sobernig @@ -284,7 +284,7 @@ structures. Previously, it was necessary, that the called object had to know the class of the serialized object, now it is as well possible to use as well specializations; fix bug, where default - value for properties lead to errors, when no propery options where + value for properties lead to errors, when no property options where given. [3fc67997] * mongodb/README: Update version numbers of mongo's c-driver older versions stopped working on macOS High Sierra. [120d6714] @@ -348,7 +348,7 @@ * dtrace/README: Fix call example, updated instructions to cover SIP deactivation, minor corrections. Added one more D script: - nsf_calltime.d. [bf3b2a85,ee6699cd] + nsf_call-time.d. [bf3b2a85,ee6699cd] * nsfDTrace.h: Re-generated. [ee6699cd] * nsf.c (NsfConfigureCmd): Fix NSF_DTRACE=1 builds. [8a3defd6] * gentclAPI.tcl, nsfAPI.decls (createconverter): Support for "-global @@ -396,7 +396,7 @@ * nsf.c: Prefer boolean over int [d4863566] * nsf.c: Reduce number of return statements beofre end of function [5e2800c9] * nsf.c: Fix regression, prefer boolean over int, reduce number of - returns befor end of function [61204e9c] + returns before end of function [61204e9c] * serializer.tcl: Ease life of colon-cmd caching [b35a18bd] * nsf.c (NsfSetterMethod): Don't pass colon-prefixed method names from setter cmd to SetInstVar() to avoid potential Index: Makefile.in =================================================================== diff -u -rd6d259af68d38051e21df141ccfc56855fcb5fe5 -r2a955681817e4db4776d7ae904babe8053c5ad74 --- Makefile.in (.../Makefile.in) (revision d6d259af68d38051e21df141ccfc56855fcb5fe5) +++ Makefile.in (.../Makefile.in) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -288,7 +288,7 @@ #======================================================================== # TEA TARGETS. Please note that the "libraries:" target refers to platform -# independent files, and the "binaries:" target inclues executable programs and +# independent files, and the "binaries:" target includes executable programs and # platform-dependent libraries. Modify these targets so that they install # the various pieces of your package. The make and install rules # for the BINARIES that you specified above have already been done. Index: configure.ac =================================================================== diff -u -r9b831c84733568b14118c288e19191bdc7e35a8e -r2a955681817e4db4776d7ae904babe8053c5ad74 --- configure.ac (.../configure.ac) (revision 9b831c84733568b14118c288e19191bdc7e35a8e) +++ configure.ac (.../configure.ac) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -221,7 +221,7 @@ DTRACE_OBJ= if test "$with_dtrace" = yes; then AC_DEFINE([NSF_DTRACE], [1], [Are we building with DTrace support?]) - # Under Mac OS X, we need no nsfDTrace.o + # Under macOS, we need no nsfDTrace.o if test "`uname -s`" != "Darwin" ; then DTRACE_OBJ=nsfDTrace.o fi Index: doc/Announce2.2.0 =================================================================== diff -u -rc1e8abb838d93f0ef5d1cca80726e4684ec8320f -r2a955681817e4db4776d7ae904babe8053c5ad74 --- doc/Announce2.2.0 (.../Announce2.2.0) (revision c1e8abb838d93f0ef5d1cca80726e4684ec8320f) +++ doc/Announce2.2.0 (.../Announce2.2.0) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -23,7 +23,7 @@ + Improved parameter parsing: Don't allow bytearrays as name of non-positional arguments, to avoid that bytearrays get unwanted string - representations (and loosing potentially the pure bytearray + representations (and losing potentially the pure bytearray property). This could lead to problems with newer Tcl versions when passing binary data to NSF procs and methods. Index: doc/example-scripts/rosetta-tree.html =================================================================== diff -u -rc4f449cb353be812ba6502ef8e9587e87881f59b -r2a955681817e4db4776d7ae904babe8053c5ad74 --- doc/example-scripts/rosetta-tree.html (.../rosetta-tree.html) (revision c4f449cb353be812ba6502ef8e9587e87881f59b) +++ doc/example-scripts/rosetta-tree.html (.../rosetta-tree.html) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -814,7 +814,7 @@ } }

This is a factory method to build up the object tree recursively -from a nested Tcl list. Note that we create left and right childs by +from a nested Tcl list. Note that we create left and right children by nesting them in their parent, this provides for a cascading cleanup of an entire tree (there is no need for an explicit cascading of destroy methods down the composite).

Index: doc/example-scripts/starmethod.html =================================================================== diff -u -rd6d259af68d38051e21df141ccfc56855fcb5fe5 -r2a955681817e4db4776d7ae904babe8053c5ad74 --- doc/example-scripts/starmethod.html (.../starmethod.html) (revision d6d259af68d38051e21df141ccfc56855fcb5fe5) +++ doc/example-scripts/starmethod.html (.../starmethod.html) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -1,1058 +1,1058 @@ - - - - - -Listing of doc/example-scripts/starmethod.tcl - - - - - -
-

Star Methods

-

Design study for implementing methods which applies to instances of -instances meta-classes. This study implements in addition to the -regular "method" a new construct called "*method" which has the -mentioned transitive property. The same behavior can be achieved in -many ways. In this study, we define a special class (the method -container class for *methods) which is kept in the precedence path -of instances. This way, it can be defined freely with other -extension mechanisms such as mixins, traits or filters.

-
-
-
nx::Class eval {
-    #
-    # Define a *method, which is a method that applies for instances of
-    # the instances of a meta-class.
-    # - *methods are only defineable on meta-classes
-    # - *methods are applicable on the instances of the instances of the
-    #   meta-class
-    # - If one defines a *method "bar" on a meta-class "MClass", and a
-    #   class "C" as an instance of "MClass", and "c1" is an instance of
-    #   "C", then "bar" is applicable for "c1".
-
-    #
-    # The "*method" has the same signature as regular methods, and can
-    # be used in combination with the modifiers
-    # public/protected/private as usual.
-    #
-    :public method *method {name arguments:parameter,0..* -returns body -precondition -postcondition} {
-        #
-        # Allow the definition only on meta-classes
-        #
-        if {![nsf::is metaclass [self]]} {
-            error "[self] is not a meta-class"
-        }
-        #
-        # Do we have the class for keeping the *methods already?
-        #
-        set starClass [nx::Class create [self]::*]
-
-        if {![nsf::object::exists $starClass]} {
-            #
-            # If not, create the *method container class and provide
-            # it as a default in the superclass hierarchy. This
-            # happens by modifying the property "-superclasses" which
-            # is used on every class to specify the class hierarchy.
-            #
-            :property [list superclasses $starClass] {
-                #
-                # Define a slot-specific method for keeping the
-                # *method container class in the hierarchy.
-                #
-                :public object method appendToRelations { class property value } {
-                    set sc [nsf::relation::get $class $property]
-                    if {$sc eq "::nx::Object"} {
-                        nsf::relation::set $class $property $value
-                    } else {
-                        nsf::relation::set $class $property [concat $sc $value]
-                    }
-                }
-
-                #
-                # Whenever the "-superclasses" relation is called,
-                # make sure, we keep the *method container class in
-                # the hierarchy.
-                #
-                :public object method value=set { class property value } {
-                    :appendToRelations $class superclass $value
-                }
-            }
-
-            #
-            # Update class hierarchies of the previously created instances
-            # of the meta-class.
-            #
-            foreach class [:info instances] {
-                set slot [$class info lookup slots superclasses]
-                $slot appendToRelations $class superclass $starClass
-            }
-        }
-
-        #
-        # Define the *method as regular method in the star method
-        # container class.
-        #
-        [self]::* method $name $arguments \
-            {*}[expr {[info exists returns] ? [list -returns $returns] : ""}] \
-            $body \
-            {*}[expr {[info exists precondition]  ? [list -precondition $precondition] : ""}] \
-            {*}[expr {[info exists postcondition] ? [list -postcondition $postcondition] : ""}]
-    }
-}
-set ::nsf::methodDefiningMethod(*method) 1
-
-

Some base test cases:

-
-

Define a meta-class MClass with a method "foo" and to star methods -named "foo" and "bar".

-
-
-
nx::Class create MClass -superclass nx::Class {
-    :public method foo {} {return MClass-[next]}
-    :public *method foo {} {return *-[next]}
-    :public *method bar {} {return *-[next]}
-}
-

Define a class based on MClass and define here as well a method -"foo" to show the next-path in combination with the *methods.

-
-
-
MClass create C {
-    :public method foo {} {return C-[next]}
-}
-
-% C info superclasses
-::MClass::*
-

Finally create an instance with the method foo as well.

-
-
-
C create c1 {
-    :public object method foo {} {return c1-[next]}
-}
-

The result of "foo" reflects the execution order: object before -classes (including the *method container).

-
-
-
% c1 info precedence
-::C ::MClass::* ::nx::Object
-% c1 foo
-c1-C-*-
-% c1 bar
-*-
-

Define a Class D as a specialization of C

-
-
-
MClass create D -superclass C {
-    :public method foo {} {return D-[next]}
-    :create d1
-}
-
-% d1 info precedence
-::D ::C ::MClass::* ::nx::Object
-% d1 foo
-D-C-*-
-

Dynamically add *method "baz".

-
-
-
% d1 baz
-::d1: unable to dispatch method 'baz'
-MClass eval {
-    :public *method baz {} {return baz*-[next]}
-}
-% d1 baz
-baz*-
-

Test adding of *methods at a time, when the meta-class has already -instances.

-

Create a meta-class without a *method

-
-
-
nx::Class create MClass2 -superclass nx::Class
-MClass2 create X {:create x1}
-% x1 info precedence
-::X ::nx::Object
-

Now add a *method

-
-
-
MClass2 eval {
-    :public *method baz {} {return baz*-[next]}
-}
-

Adding the *method alters the superclass order of already created -instances of the meta-class

-
-
-
% x1 info precedence
-::X ::MClass2::* ::nx::Object
-% x1 baz
-baz*-
-

Finally, there is a simple application example for ActiveRecord -pattern. All instances of the application classes (such as -"Product") should have a method "save" (together with other methods -now shown here). First define the ActiveRecord class (as a -meta-class).

-
-
-
Class create ActiveRecord -superclass nx::Class {
-    :property table_name
-
-    :method init {} {
-        if {![info exists :table_name]} {
-            set :table_name [string tolower [namespace tail [self]]s]
-        }
-    }
-    :public *method save {} {
-        puts "save [self] into table [[:info class] cget -table_name]"
-    }
-}
-

Define the application class "Product" with an instance

-
-
-
ActiveRecord create Product
-Product create p1
-p1 save
-

The last command prints out: "save ::p1 into table products"

-
-
-
-

- - - + + + + + +Listing of doc/example-scripts/starmethod.tcl + + + + + +
+

Star Methods

+

Design study for implementing methods which applies to instances of +instances meta-classes. This study implements in addition to the +regular "method" a new construct called "*method" which has the +mentioned transitive property. The same behavior can be achieved in +many ways. In this study, we define a special class (the method +container class for *methods) which is kept in the precedence path +of instances. This way, it can be defined freely with other +extension mechanisms such as mixins, traits or filters.

+
+
+
nx::Class eval {
+    #
+    # Define a *method, which is a method that applies for instances of
+    # the instances of a meta-class.
+    # - *methods are only defineable on meta-classes
+    # - *methods are applicable on the instances of the instances of the
+    #   meta-class
+    # - If one defines a *method "bar" on a meta-class "MClass", and a
+    #   class "C" as an instance of "MClass", and "c1" is an instance of
+    #   "C", then "bar" is applicable for "c1".
+
+    #
+    # The "*method" has the same signature as regular methods, and can
+    # be used in combination with the modifiers
+    # public/protected/private as usual.
+    #
+    :public method *method {name arguments:parameter,0..* -returns body -precondition -postcondition} {
+        #
+        # Allow the definition only on meta-classes
+        #
+        if {![nsf::is metaclass [self]]} {
+            error "[self] is not a meta-class"
+        }
+        #
+        # Do we have the class for keeping the *methods already?
+        #
+        set starClass [nx::Class create [self]::*]
+
+        if {![nsf::object::exists $starClass]} {
+            #
+            # If not, create the *method container class and provide
+            # it as a default in the superclass hierarchy. This
+            # happens by modifying the property "-superclasses" which
+            # is used on every class to specify the class hierarchy.
+            #
+            :property [list superclasses $starClass] {
+                #
+                # Define a slot-specific method for keeping the
+                # *method container class in the hierarchy.
+                #
+                :public object method appendToRelations { class property value } {
+                    set sc [nsf::relation::get $class $property]
+                    if {$sc eq "::nx::Object"} {
+                        nsf::relation::set $class $property $value
+                    } else {
+                        nsf::relation::set $class $property [concat $sc $value]
+                    }
+                }
+
+                #
+                # Whenever the "-superclasses" relation is called,
+                # make sure, we keep the *method container class in
+                # the hierarchy.
+                #
+                :public object method value=set { class property value } {
+                    :appendToRelations $class superclass $value
+                }
+            }
+
+            #
+            # Update class hierarchies of the previously created instances
+            # of the meta-class.
+            #
+            foreach class [:info instances] {
+                set slot [$class info lookup slots superclasses]
+                $slot appendToRelations $class superclass $starClass
+            }
+        }
+
+        #
+        # Define the *method as regular method in the star method
+        # container class.
+        #
+        [self]::* method $name $arguments \
+            {*}[expr {[info exists returns] ? [list -returns $returns] : ""}] \
+            $body \
+            {*}[expr {[info exists precondition]  ? [list -precondition $precondition] : ""}] \
+            {*}[expr {[info exists postcondition] ? [list -postcondition $postcondition] : ""}]
+    }
+}
+set ::nsf::methodDefiningMethod(*method) 1
+
+

Some base test cases:

+
+

Define a meta-class MClass with a method "foo" and to star methods +named "foo" and "bar".

+
+
+
nx::Class create MClass -superclass nx::Class {
+    :public method foo {} {return MClass-[next]}
+    :public *method foo {} {return *-[next]}
+    :public *method bar {} {return *-[next]}
+}
+

Define a class based on MClass and define here as well a method +"foo" to show the next-path in combination with the *methods.

+
+
+
MClass create C {
+    :public method foo {} {return C-[next]}
+}
+
+% C info superclasses
+::MClass::*
+

Finally create an instance with the method foo as well.

+
+
+
C create c1 {
+    :public object method foo {} {return c1-[next]}
+}
+

The result of "foo" reflects the execution order: object before +classes (including the *method container).

+
+
+
% c1 info precedence
+::C ::MClass::* ::nx::Object
+% c1 foo
+c1-C-*-
+% c1 bar
+*-
+

Define a Class D as a specialization of C

+
+
+
MClass create D -superclass C {
+    :public method foo {} {return D-[next]}
+    :create d1
+}
+
+% d1 info precedence
+::D ::C ::MClass::* ::nx::Object
+% d1 foo
+D-C-*-
+

Dynamically add *method "baz".

+
+
+
% d1 baz
+::d1: unable to dispatch method 'baz'
+MClass eval {
+    :public *method baz {} {return baz*-[next]}
+}
+% d1 baz
+baz*-
+

Test adding of *methods at a time, when the meta-class has already +instances.

+

Create a meta-class without a *method

+
+
+
nx::Class create MClass2 -superclass nx::Class
+MClass2 create X {:create x1}
+% x1 info precedence
+::X ::nx::Object
+

Now add a *method

+
+
+
MClass2 eval {
+    :public *method baz {} {return baz*-[next]}
+}
+

Adding the *method alters the superclass order of already created +instances of the meta-class

+
+
+
% x1 info precedence
+::X ::MClass2::* ::nx::Object
+% x1 baz
+baz*-
+

Finally, there is a simple application example for ActiveRecord +pattern. All instances of the application classes (such as +"Product") should have a method "save" (together with other methods +now shown here). First define the ActiveRecord class (as a +meta-class).

+
+
+
Class create ActiveRecord -superclass nx::Class {
+    :property table_name
+
+    :method init {} {
+        if {![info exists :table_name]} {
+            set :table_name [string tolower [namespace tail [self]]s]
+        }
+    }
+    :public *method save {} {
+        puts "save [self] into table [[:info class] cget -table_name]"
+    }
+}
+

Define the application class "Product" with an instance

+
+
+
ActiveRecord create Product
+Product create p1
+p1 save
+

The last command prints out: "save ::p1 into table products"

+
+
+
+

+ + + Index: doc/next-migration.html =================================================================== diff -u -r69a2fff0fc8fe546a79002bb7b7e4b110483368b -r2a955681817e4db4776d7ae904babe8053c5ad74 --- doc/next-migration.html (.../next-migration.html) (revision 69a2fff0fc8fe546a79002bb7b7e4b110483368b) +++ doc/next-migration.html (.../next-migration.html) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) @@ -1,726 +1,726 @@ - - - - - -Migration Guide for the Next Scripting Language - -