[Xotcl] Improvement proposal for instfilters and guards

Eckhard Lehmann eckhardnospam at gmx.de
Tue May 27 22:33:31 CEST 2008


Hi all,

instfilters and -guards are great features in XOTcl. Nevertheless there 
is room for improvement...

In 99% of the cases one (I at least) creates a filter that needs to be 
triggered only at a certain method. Even if one has several methods to 
intercept, it is often easier to create separate methods and use guards 
to trigger them.
Guards are great, but the overall picture of the code gets overly 
complicated in such cases. Therefore I'd like to propose an argument 
"-methods" to the filter command, that tells the filter to only be 
triggered on execution of the methods in the corresponding list:

Class A
...
A instproc do1 {} ...
A instproc do2 {} ...
A instproc do3 {} ...

A instproc do1Filter {} ...

# trigger only at do1
A instfilter do1Filter -methods do1 ;# or -methods {do1 do3}

# rather than
A instfilter do1Filter
A instfilterguard do1 {[string eq [self calledproc] do1]}

Is such a feature already planned? If not, is there anything that speaks 
against it?


-- 
Eckhard



More information about the Xotcl mailing list