From: "T. Onoma" Date: 2003-11-27T03:06:01+09:00 Subject: Re: Controlled block variables On Wednesday 26 November 2003 06:14 pm, ts wrote: > >>>>> "T" == T Onoma writes: > > T> So ask, should it continue to do so with the addition of hooks? (Not to > T> mention there are some fundemental problems with this disallowing.) > > Which problems ? > > > Guy Decoux First, small problem class A def dolittle print "duck" end def dolittle:hook # where's the super? what do i do? print "rabbit" end end A little bigger class A def dolittle print "duck" end def dolittle:hook super print "rabbit" end end class B < A def dolittle:hook # am i replacing old hook? (there's no local dolittle) super # or am i supering to old hook? print "fox" end end Much bigger problem: a library the i don't know how it works, i'm just using it: class L def dolittle print "duck" end def dolittle:hook super print "rabbit" end end l = L.new l.dolittle # => duckrabbit no no i say, i want dolittle's "duckradditstew"! class L def dolittle:hook super print "stew!" end end l.dolittle # => duckstew! Yuk! I don't like plain duckstew. But the worst problem of all is simply that not allowing multiple wraps, so severely limits the capabilities of this mechinism that it would actually have no general use whatsoever. indeed it would actually be highly advisable NOT to ever use it b/c of the last example given above, and would only ever be really useful for devleopment/testing purposes alone. (not to mention other issues with super) -t0