Index: library/nx/plain-object-method.tcl =================================================================== diff -u -N -r199e95f5c3774fc56dfb85a47f99c0b8141bf29e -r471c9589c601e576f2bc5f3e2dd4c554a0ceee1c --- library/nx/plain-object-method.tcl (.../plain-object-method.tcl) (revision 199e95f5c3774fc56dfb85a47f99c0b8141bf29e) +++ library/nx/plain-object-method.tcl (.../plain-object-method.tcl) (revision 471c9589c601e576f2bc5f3e2dd4c554a0ceee1c) @@ -1,5 +1,34 @@ package provide nx::plain-object-method 1.0 +# +# Provide a convenience layer to define/introspect object specific +# methods without having to use the "object" modifier. By using this +# package, one can use instead of +# +# nx::Object create o { +# :public object method foo args {....} +# :object property p:integer +# :object mixin add M +# #... +# puts [:info object methods] +# } +# +# simply +# +# package require nx::plain-object-method +# +# nx::Object create o { +# :public method foo args {....} +# :property p:integer +# :mixin add M +# #... +# puts [:info methods] +# } +# +# Note that for object specific methods of classes, one has still to +# use "object method" etc. (see also package nx::plass-method). +# + namespace eval ::nx { # @@ -8,7 +37,9 @@ # # nx::configure plain-object-method-warning on|off # - # for activation/deactivation of tracing + # for activation/deactivation of tracing. This might be + # useful for porting legacy NX programs or for testing + # default-configuration compliance. # nx::configure public object method plain-object-method-warning {onoff:boolean,optional} { if {[info exists onoff]} { @@ -27,17 +58,26 @@ # # Definitions redirected to "object" # - foreach m {alias filter forward method mixin property variable} { + foreach m { + alias + filter + forward + method + mixin + property + variable + } { :public method $m {args} { nx::configure plain-object-method-warning :object [current method] {*}[current args] } } # - # info subcmmands + # info subcommands # - foreach m {method methods slots variables + foreach m { + method methods slots variables "filter guards" "filter methods" "mixin guards" "mixin classes" } { @@ -47,6 +87,20 @@ }] } + # + # deletions for object + # + foreach m { + "property" + "variable" + "method" + } { + nx::Object public method "delete $m" {args} { + nx::configure plain-object-method-warning + :delete object [current method] {*}[current args] + } + } + }