submethods.test

Clone Tools
  • last updated 38 mins ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
nx::test: - change test cases to newer interface - don't use "namespace import nx::*" in test cases when not required

  1. … 34 more files in changeset.
nx.tcl: - 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 write o1 info configure instead of o1 info lookup configure syntax

  1. … 7 more files in changeset.
nx.tcl: - removed "info is .." since it might raise more questions than it solves

  1. … 9 more files in changeset.
Method and configure parameter reform, Part 3: - added

/cls/ info lookup variables -> list of handles

/obj/ info lookup object variables -> list of handles

/obj/ info variable definition|name|parameter /handle/

- nx.tcl: added forward compatible scripted implementation of "lmap"

- nsf.c: handle names for private slots in pattern provided to AddSlotObjects(),

used e.g. in "info lookup slots /pattern/"

  1. … 7 more files in changeset.
- dropped "/obj/ info slot definition /obj/" in favor of "/slotobj/ definition"

  1. … 6 more files in changeset.
Method and configure parameter reform, Part 2: In order to streamline the interface further, we tried to follow the idea to use "... info /plural word/" to obtain a set of handles, and then a separate call to obtain the details. Therefore, we replaced

/cls/ info slot objects

/cls/ info slot definitions

/cls/ info slot names

/obj/ info object slot objects

/obj/ info object slot definitions

/obj/ info object slot names

/obj/ info lookup slots

by

/cls/ info slots ?-type /type/? ?-closure? ?-source all|application|baseclasses? ?/pattern/?

/obj/ info object slots ?-type /type/? ?/pattern/?

/obj/ info slot definition /obj/

/obj/ info lookup slots ?-type /type/? ?-source all|application|baseclasses? ?/pattern/?

  1. … 9 more files in changeset.
- Method and configure parameter reform

/cls/ info configure parameters ?pattern? -> list of params

/cls/ info configure syntax -> syntax output

/obj/ info method parameters /methodName/ ?/pattern/? -> list of params

/obj/ info method syntax -> syntax output

/obj/ info lookup configure parameter ?/pattern/? -> list of params

/obj/ info lookup configure syntax -> syntax output

/cls/ info parameter list|name|syntax /param/ -> value

  1. … 14 more files in changeset.
- moved "/obj/ info slot definition|..." to "/obj/ info object slot definition|..." for consistency - provided "parametersyntax()" for "object mixin" and "object filter"

  1. … 4 more files in changeset.
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.
- 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 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.
- start error messages with a lower case word for consistency and to follow closer to Tcl's conventions

  1. … 6 more files in changeset.
- explorative implementation of object method dispatches with KEEP_CALLER_SELF and no NSF_PER_OBJECT_DISPATCH - extend regression test

  1. … 2 more files in changeset.
- remove debug line

- add regression test for keepcallerself with and without perobjectdispatch

- improve error message to indicate, that nsf refuses to overwrite (redefine) some cmds

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

  1. … 5 more files in changeset.
- extend regression test for interactions between "keepcallerself" and "perobjectdispatch" - some minor cleanup

  1. … 2 more files in changeset.
- fixed potential crash from method caching, when permissions on cmds are changed and become e.g. unresolvable - removed flag allowmethoddispatch, since behavior can be achived via private flag. - extended regression test

  1. … 9 more files in changeset.
- deacitivate for the time being allowmethoddispatch (make it behave always like true) - added instead new flag "perobjectdispatch" to make behavior of ensembleobjects configurable. - The behavior for keepcallerself is currently only activated for the method-interface for object dispatch, since otherwise the following would be dangerous, since "o2 foo" would destroy o2 nx::Object create o1 nsf::object::property o1 keepcallerself true nx::Object create o2 { ::public method foo {} {o1 destroy} } o2 foo

  1. … 10 more files in changeset.
- alias reform: instead of calling first an alias with a stack frame followed by the dispatched of the aliased cmd, resolve aliases internally in dispatch. This has the advantage that we do not have to ignore the "transparent" stack frame in some sitations, and we have much less problems with the names of the aliased cmds (e.g. objects) in the introspection methods. Additionally, several problem cases disappeared from the regression test cases. In addition, the new approach is faster. - eliminating obsolete flag NSF_CSC_CALL_IS_TRANSPARENT

  1. … 9 more files in changeset.
- Added exerpimental object property "allowmethoddispatch" for child-objects to be called from parent objects via method interface. Background: both, per-object methods and childobjects are implemented via cmds in the same tcl namespace. Without special care, both are callable via the standard dispatch. Apparently, this is not always wanted. - handled allowmethoddispatch and keepcallerself in copy/move - set allowmethoddispatch per-default in XOTcl - removed visablilty of objects with "allowmethoddispatch" false in "info methods" and "info search methods" - extended regression test

  1. … 10 more files in changeset.
- rename "info method handle /methodName/" into "info method registrationhandle /methodName/" - rename "info method origin /methodName/" into "info method definitionhandle /methodName/" - added "info method origin" to return the target of an alias (or empty)

  1. … 19 more files in changeset.
- generic/nsfAPI.h: Renamed the [::nsf::current next] subcommand to [::nsf::current nextmethod] - library/xotcl/library/xotcl2.tcl: Accordingly, the xotcl::self emulation maps [self next] to [current nextmethod] - tests/disposition.test, tests/methods.test, tests/submethods.test, tests/tcloo.test: Changed the few occurrences of [current next] to [current nextmethod] - tests/introspection.test: Added some basic tests on the expected behaviour of [::nsf::current nextmethod]

  1. … 8 more files in changeset.
- nx.tcl: * added "/obj/ info slot definition" * added "/obj/ info slot name" * added "/obj/ info properties" (alias to "/obj/ info slot definition") * extended regression test

  1. … 4 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.
- generic/nsf.c / NextSearchAndInvoke(): Prior to this commit, next calls from within submethod leaves resulted in the interp's unknown flag to be set. While for dispatches without filter indirection this remains hidden and unnoticed, registered filters triggered an unwanted unknown dispatch in such scenarios. Consequently, such leaf next's in submethods behaved differently from the method equivalents. The patch identifies such leaf-next dispatches by watching out for a characteristic callstack structure. - tests/submethods.test: Add a characteristic test for the above patch. - tests/disposition.test: Some cleanup ...

  1. … 2 more files in changeset.
- Further testing on [current calledmethod|class] and submethods; added to-dos

  1. … 1 more file in changeset.
- generic/nsf.c: Fixed [current callingmethod] for submethods (i.e., reporting submethods as calling methods, including their methodpath). Added tests covering the fix (see tests/submethods.test). - generic/nsfStack.c (CallStackMethodPath): Re-arranged the traversal slightly, to escape non-ensemble frames (eval CFRAMEs) as parts of the method path. Added test (see tests/submethods.test). - library/nx/nx.tcl: Corrected the impl of Ensemble->defaultmethod() (e.g., used self instead of current) - tests/disposition.test: Fixed test cases turned out to be false positives. Before the fixes, [current methodpath] gave non-empty results for simple object aliases.

  1. … 4 more files in changeset.