daz wrote:

> Wrap is a controlling 'outer' wrap.  The combination of
> pre/post would be a benign 'inner' wrap.  Benign in the
> sense that you could safely assume that you wouldn't
> accidentally be changing the program's logic.

actually, i think, with a programming language like ruby, worrying about changing program logic is sort of like worrying about strong typing. i think most rubyists are more instrested in having the control, even if measn we can break things. its not like we can't fix them! :)  in light of this i've been thinking about allowing complete access to methods and lambdas through an array like interface, where each statment is indexed. something like:

  pm = lambda { p 'hi'; x = 4; x }
  pm[0] # => { p 'hi' }
  pm[1] # => { x = 4 }
  pm[2] # => { x }

so each statment is like a little lambda. then you can actually manipulate these:

  pm << { x + 1 }
  pm[0..-1]  # => { p 'hi'; x = 4; x; x + 1 }
  pm[0] = lambda { p 'hello' } if pm[0].to_s.include?('hi')

which is like a wrap, but much more "aware".

of course this requires a little panning out of the syntax to work well. but ruby is so dynamic, i imagine it is quite possible.

-t0

p.s. you'll find this idea explained a little more, and generalized to all structures, in my RCR.