object-system.test

Clone Tools
  • last updated 12 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Object-method Reform: - changed interface to object specific commands by requiring an ensemble named "object". The rational behind is essentially to use always the same info command to retrieve object specific methods, no matter whether these are defined on a plain object or an a class object (does not break the "contract" what e.g. "info method" returns).

Now we define methods via:

/cls/ method foo {args} {...body...}

/cls/ object method foo {args} {...body...}

/obj/ object method foo {args} {...body...}

Similarly, aliases, forwards and mixins are defined, e.g.

/cls/ mixin add ...

/cls/ object mixin add ...

/obj/ object mixin add ...

/obj/ require object method ...

The same change propagated as well to the "info" method.

Now we have:

/cls/ info methods ...

/cls/ info object methods ...

/obj/ info object methods ...

Similar, the object parametererization uses

/cls/ create obj -object-mixin M

/cls/ create obj -object-filter f

/metacls/ create cls -mixin M1 -object-mixin M2

/metacls/ create cls -filter f1 -object-filter f2

- as a consequence,

a) "/cls/ class method ...",

"/cls/ class alias ...",

"/cls/ class forward ...",

"/cls/ class filter ...",

"/cls/ class mixin ...",

"/cls/ class info ..."

"/obj/ class method require method ..."

"/obj/ class method require public method ..."

"/obj/ class method require protected method ..."

"/obj/ class method require private method ..."

were dropped

b) "/obj/ method ....",

"/obj/ alias ....",

"/obj/ forward ...."

"/obj/ filter ...."

"/obj/ mixin ...."

"/obj/ info method*"

"/cls/ create obj -mixin M"

"/cls/ create obj -filter f"

"/obj/ method require method ..."

"/obj/ method require public method ..."

"/obj/ method require protected method ..."

"/obj/ method require private method ..."

were dropped

- added package nx::class to allow optionally the "class" notation

"/cls/ class method ..." (and friends, see (a)), and

"/cls/ class info ...

- added package nx::plain-object-method to allow optionally plain method

b) "/obj/ method ...." (and friends, see (b))

- add support to slots to use ensemble methods as setters

  1. … 43 more files in changeset.
- allow explicit unsetting of -per-object flag in 0-argument -flag=value notation

  1. … 2 more files in changeset.
- changed name "/obj|cls/ slot info definition" to "/obj|cls/ slot info definition" since result is a set - dropped parameter method "properties" - dropped "/obj/ info properties" (since "properties" or "variables" are returned")

  1. … 8 more files in changeset.
Property Reform Part 2: better handling of per-object properties nsf.c: - changed "/class/ __objectconfigure" to "/obj/ __objectconfigure" to be able to handle per-object properties on classes properly. - renamed "info method parametersyntax" -> "info method syntax" - renamed "/obj|cls/ info method parametersyntax" into "/obj|cls/ info method syntax" - replaced "::nsf::methods::class::info::objectparameter" by "::nsf::methods::object::info::objectparameter" - new command "::nsf::parameter::specs ?-configure? ?-noposargs? slotobjs": convert provided slotobjs into a list of parameter specs - new command "::nsf::parameter::get list|name|syntax parameterspec": convert parameter spec into syntax form, or retrieve pieces of information from it (can be extended in the future) - added more or less generic list handling functions TclObjListFreeList(), TclObjListNewElement() and TclObjListAdd() used by "::nsf::parameter::specs" - replaced "::nsf::method::property /obj/ -per-object /name/ slotcontainer ?value?" by "::nsf::object::property /obj/ slotcontainer ?value?" - added "::nsf::object::property /obj/ hasperobjectslots ?value?"

nx.tcl:

- new info methods

* "/obj/ info lookup parameter definitions"

* "/obj/ info lookup parameter names"

* "/obj/ info lookup parameter list"

* "/obj/ info lookup parameter syntax"

- changed "/cls/ info parameter definition ?name?"

into "/cls/ info parameter definitions ?name?"

since ir returns a list. Still, "list" or "syntax" won't

be plural

  1. … 18 more files in changeset.
Property reform part 1:

- disallow protection modifiers for "properties" and

add new flag "-accessor" to "property" and "variable"

This changes definitions like

Class create C {

:property {a a1}

:public property {b b1}

:protected property {c c1}

:private property {d d1}

}

to

Class create C {

:property {a a1}

:property -accessor public {b b1}

:property -accessor protected {c c1}

:property -accessor private {d d1}

}

since "properties" are always public accessible

over the "configure" and "cget" interface, but the

accessors methods might not be public. The value of

the accessor might be also "none" (specifying explicitely

that no accessor is wanted) or "", which means: use the default.

Same holds for "variable"

- disallow parameter option "incremental" and change it to a flag

of the property or variable. The motivation for this is due to

the fact, that "incremental" is a property of the accessor, and

not of the value.

old:

Class create C {

:property foo:int,incremental

:variable bar:int,incremental

}

new:

Class create C {

:property -incremental foo:int

:variable -incremental bar:int

}

- disallow "public class property" and friends since these are not needed

- removed parameter property "noaccessor"

- removed "nx::configure defaultPropertyCallProtection" and

method hook "__default_property_call_protection"

- introduced "nx::configure defaultAccessor" and

method hook "__default_accessor"

- for the time being, "defaultAccessor" is "public" for NX and XOTcl,

will be changed to "none" in NX

- extended regression test (new file properties.test)

  1. … 16 more files in changeset.
nx.tcl: - rename the following internally called methods (not for XOTcl). alloc -> __alloc dealloc -> __dealloc objectparameter -> __objectparameter recrate -> __recreate - from these methods, only __objectparameter is defined per default, the others are defined on demand

  1. … 6 more files in changeset.
- rename nx::Object.configure to nx::Object.__configure to free method name "configure" for an e.g. tk-like configure

  1. … 5 more files in changeset.
- extended regression test

- don't allow method to overwrite child object - extended regression test - documented new feature as incompatibility with XOTcl 1

  1. … 4 more files in changeset.
- don't allow object creation to overwrite non-object cmds (e.g. procs)

  1. … 5 more files in changeset.
- changed object->flags from "unsigend short" to "unsigned int" - reintroduced NSF_TCL_DELETE to address bug flagged from memdebug - extended regression test

  1. … 3 more files in changeset.
nsf.c: - change argument of IsMetaClass() to type *NsfObject - provide basic pretection against most likely unintended deletion/overwriting of base classes. - extend regression test

  1. … 2 more files in changeset.
- Avoid duplicate entries in instance lists for diamond inheritance by maintaining the set of already processed entries in NsfClassInfoInstancesMethod1() and GetAllInstances(). - extended regression test - removed "namespace import" in objectsystem test

  1. … 2 more files in changeset.
- nx.tcl: * do not namespace import my into ::nx * replace usages of "my" by colon invocations

  1. … 2 more files in changeset.
- nsf.c - added experimental parameter option noleadingdash - additionalal regression test file method-parameter.test - provide selective error messages for unknown nonpos args

  1. … 11 more files in changeset.
- added minimal regression tests for argument parsing to object-system test

- nsf.c: make ":" a full equivalent vor nsf::my (i.e. support -local, -system and -intrinsic) - extend regression test

  1. … 4 more files in changeset.
- nsf.c: * allowed to call ":" like "my" or "self"

Object create o

o public method bar2 {} {return bar2-[: foo]}

o public method bar5 {} {return [self]::bar5}

o public method bar6 {} {return [:]::bar6}

* extended regression test

  1. … 2 more files in changeset.
- renamed "nsf::method::dispatch" to "nsf::directdispatch" - renamed "nsf::object::dispatch" to "nsf::dispatch"

  1. … 16 more files in changeset.
- nsf.c: experimental implementation of ::nsf::method::dispatch

  1. … 8 more files in changeset.
- nx.tcl * renamed "info parameter name" to "info parameter names" (since it returns a list of names) * renamed "info parameter name" to "info parameter names" (since it returns a list of names) * renamed "info slots" to "info slot objects" * additional method "info slot definition" * additional method "info slot name" * additional method "info properties" (alias to "info slot definition") * removed "info parameter slot" * use term "noaccessor" and "noconfig" to deactivate accessors or object-parameters in property definitions * don't show slots with noconfig in "info parameter names" * don't show slots with noconfig in "info parameter definition" * renamed slot property "configparam" to "config" * renamed "::nsf::methods::class::info::slots" to "::nsf::methods::class::info::slotobjects" * additional public method ObjectParameterSlot.getPropertyDefinition * updated and extended regression test

  1. … 14 more files in changeset.
- nx.tcl * renamed "attribute" to "property" * renamed "defaultAttributeCallProtection" to "defaultPropertyCallProtection" * renamed "nx::Attribute" to ""nx::VariableSlot" * renamed "BootStrapAttributeSlot" to "BootStrapVariableSlot" * renamed "createBootstrapAttributeSlots" to "createBootstrapVariableSlots" * removed method attributes * implemented old attributes definition in xotcl2 as method "parameter"

  1. … 32 more files in changeset.
- nx.tcl: implemented copy without a provided name. If argument of copy is omitted, the copied object is created with a fresh name (i.e. created with the method "new"). Example set x [o copy] - extended regression test

  1. … 2 more files in changeset.
- extended regrssion test

- generalized "nsf::object::initialized" to nsf::object::property objectName initialized|class|rootmetaclass|rootclass|slotcontainer

  1. … 4 more files in changeset.
- regularized more nsf::* names: renamed "nsf::createobjectsystem" => "nsf::objectsystem::create" renamed "nsf::unknown" => "nsf::object::unknown" renamed "nsf::dispatch" => "nsf::object::dispatch"

  1. … 17 more files in changeset.
- nsf.c: * Don't output non-consuming procs (which are always called) via parametersyntax (shows, what a user can input) * additional command ::nsf::object::initialized to check whether an object is already initialized * new function DispatchInitMethod() similar to DispatchDefaultMethod() * let residualargs call init directly instead of doing it the inidrect way * provided ability to call init with object parameters at arbitrary times * switch from Tcl_ObjCmdProc style interface (ClientData first) to a C stype interface for DispatchDefaultMethod(), DispatchUnknownMethod() * bring cmd definitions for nsf::object in right order - extended regression test

  1. … 9 more files in changeset.
- Use mixinregObjType as well in NsfRelationCmd(), so this is the only place, where mixin and guards are processed. - Since the type converter converts Tcl-Objs, we have less context information (e.g. we have no base class, on which we can decide to call e.g. __unknown on on of the objects systems). - because of the point above, i removed ::xotcl::Class->__unknown and ::nx::Class->__unknown in favor of a global proc ::nsf::unknown, for which unknown handlers can be registered - GetClassFromObj() receives as last argument "withUnknown" instead of baseClass to indicate, when unknown should be tried. - new function NsfCallUnkownHandler()

  1. … 9 more files in changeset.
- nsf.c: Since the method "objectparameter" is just based on the class (and object parameters are invalidates as well over the class), we moved the method from obj to class to avoid potential confusions

  1. … 8 more files in changeset.
- nsf: renamed nsf::isobject to nsf::object::exists - nsf: renamed nsf::qualify to nsf::object::qualify

  1. … 17 more files in changeset.