[Xotcl] filters and next

Andriy Tkachuk ant at imt.com.ua
Mon Apr 22 16:15:44 CEST 2002


hello!

it seems yet another bug with this theme:
if there are several filters:

Class A
A instproc msg args {
        puts [concat A: $args]
        next
}

Class B -superclass A
B instproc msg args {
        my instvar a b
        puts [concat B: $args]
        next
}

B instproc my_filter args {
        set ff [my info filter]
        puts "filter: calledproc: [self calledproc]; args: $args"
        my msg "in filter before next; calledproc: [self calledproc]"
        set res [next]
        #my msg "in filter after next; calledproc: [self calledproc]"
        return $res
}

B instproc my_filter2 args {
        return [next]
}

B b

b filter {my_filter my_filter2}

xotclsh [/usr~]b msg bb
filter: calledproc: msg; args: bb
B: {in filter before next; calledproc: msg}
B: {in filter before next; calledproc: msg}
A: {in filter before next; calledproc: msg}
xotclsh [/usr~]

if uncomment in my_filter msg in post-next part, then:
"too many nested calls to Tcl_EvalObj"

thanks,
  Andriy.

On Fri, 19 Apr 2002, Uwe Zdun wrote:

> Hi Andriy,
>
> this was a little bug. We have closed down the filter chain upon the "msg"
> method but the filter was not done with its own next. I'll attach an xotcl.c
> file that should fix the problem (the fix will also be in the next xotcl
> release ... but as this is a quite unusual case we don't produce a full patch
> release for this fix). Simply replace the xotcl.c file in the distribution
> and re-compile ...
>
> --uwe
>
>
> On Wednesday 17 April 2002 05:46 pm, Andriy Tkachuk wrote:
> > Hello! :)
> >
> > How it must works, when in pre/post part of filter
> > object calls his procs that calls next?
> > Situation like here:
> >
> > Class A
> > A instproc msg msg {
> >         puts "puts: $msg"
> > }
> >
> > Class B -superclass A
> > B instproc msg msg {
> >         next
> > }
> >
> > B instproc my_filter args {
> >         my msg "before next in filter"
> >         next
> > }
> >
> > B b
> >
> > b filter my_filter
> > b msg bb
> > puts: before next in filter
> >
> > that's all!: there is no "puts: bb".
> >
> > if filter like this:
> >
> > B instproc my_filter args {
> >         my msg "before next in filter"
> >         next
> >         my msg "after next in filter"
> > }
> >
> > then:
> > "too many nested calls to Tcl_EvalObj"
> >
> > Thank you.
> >
> > _______________________________________________
> > Xotcl mailing list  -  Xotcl at alice.wu-wien.ac.at
> > http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>

--
  Because strait is the gate, and narrow is the way, which leadeth unto
   <b>life</b>, and few there be that find it. (MAT 7:7)
 <b>Ask</b>, and it shall be given you; <b>seek</b>, and ye shall find;
   <b>knock</b>, and it shall be opened unto you... (MAT 7:14)





More information about the Xotcl mailing list