Index: TODO =================================================================== diff -u -r9efc836c8e0eb0106afa5370a3dca6c1bcb7c162 -rd6e5661d520977831094caa5d2c8a5567567ecc3 --- TODO (.../TODO) (revision 9efc836c8e0eb0106afa5370a3dca6c1bcb7c162) +++ TODO (.../TODO) (revision d6e5661d520977831094caa5d2c8a5567567ecc3) @@ -5026,6 +5026,8 @@ ======================================================================== TODO: +- remove "-guard" from mixin and filter specs, just have two-element lists? + - why is there no pos/index arg for mixin|filter delete? - nsf.c: finish forwarder error messages Index: doc/filter.man.inc =================================================================== diff -u -rc4cb0af2d70fbb925613e396747d365823be5465 -rd6e5661d520977831094caa5d2c8a5567567ecc3 --- doc/filter.man.inc (.../filter.man.inc) (revision c4cb0af2d70fbb925613e396747d365823be5465) +++ doc/filter.man.inc (.../filter.man.inc) (revision d6e5661d520977831094caa5d2c8a5567567ecc3) @@ -16,9 +16,9 @@ an existing method of [arg obj] which becomes registered as a filter. If having three elements, the third element [arg guardExpr] will be stored as a guard expression of the -[term "filter"]. This guard expression will be evaluated using -[cmd expr] when [arg obj] receives a message to determine if the -filter applies. Guard expressions +[term "filter"]. This guard expression must be a valid Tcl expression +(see [cmd expr]). [arg expr] is evaluated when [arg obj] receives a message to determine whether the +filter should intercept the message. Guard expressions allow for realizing context-dependent or conditional filter composition. If [arg filterSpecList] represents an empty list, any existing [term "filter"] will be removed from [arg obj]. @@ -31,12 +31,20 @@ omitted, [arg index] defaults to the list head (0). [def "[arg obj] [const [vset SCOPE]] [method {filter delete}] [option -nocomplain] [arg specPattern]"] -Removes a single [term "filter"] from a current list of [term "filter"]s of +Removes a single [term "filter"] from the current list of [term "filter"]s of [arg obj] whose spec matches [arg specPattern]. [arg specPattern] can contain special matching chars (see [cmd "string match"]). [const [vset SCOPE]] [method "filter delete"] will throw an error if there is no matching [term "filter"], unless [option -nocomplain] is set. +[def "[arg obj] [const [vset SCOPE]] [method {filter guard}] [arg methodName] [arg expr]"] + +Registers a guard expression [arg expr] with a filter [arg methodName] +in a separate step, once the filter was set or added using [const [vset SCOPE]] [method {filter set}] or +[const [vset SCOPE]] [method {filter add}]. [arg expr] must be a valid Tcl expression (see +[cmd expr]). An empty string for [arg expr] will clear the currently registered +guard expression for filter [arg methodName]. + [list_end] Every [arg methodName] in a [arg spec] must resolve to an existing method in the scope of the [vset SCOPE]. To Index: doc/mixin.man.inc =================================================================== diff -u -rc4cb0af2d70fbb925613e396747d365823be5465 -rd6e5661d520977831094caa5d2c8a5567567ecc3 --- doc/mixin.man.inc (.../mixin.man.inc) (revision c4cb0af2d70fbb925613e396747d365823be5465) +++ doc/mixin.man.inc (.../mixin.man.inc) (revision d6e5661d520977831094caa5d2c8a5567567ecc3) @@ -31,6 +31,14 @@ [comment {Therefore, by default, any added [term "mixin class"] takes precedence over previously added classes in the overall linearisation of [arg obj].}] [def "[arg obj] [const [vset SCOPE]] [method {mixin delete}] [option -nocomplain] [arg specPattern]"] Removes a [term "mixin class"] from a current list of [term "mixin class"]es of [arg obj] whose spec matches [arg specPattern]. [arg specPattern] can contain special matching chars (see [cmd "string match"]). [const [vset SCOPE]] [method "mixin delete"] will throw an error if there is no matching [term "mixin class"], unless [option -nocomplain] is set. + +[def "[arg obj] [const [vset SCOPE]] [method {mixin guard}] [arg className] [arg expr]"] + +Registers a guard expression [arg expr] with the [term "mixin class"] [arg className] +in a separate step, once the [term "mixin class"] was set or added using [const [vset SCOPE]] [method {mixin set}] or +[const [vset SCOPE]] [method {mixin add}]. [arg expr] must be a valid Tcl expression (see +[cmd expr]). An empty string for [arg expr] will clear the currently registered +guard expression for the registered [term "mixin class"] [arg className]. [list_end] [comment { A [term "mixin class"] whose spec is featured earlier in [arg mixinSpecList] takes