From: Erik Veenstra Date: 2006-07-24T00:06:37+09:00 Subject: Re: Meta-Meta-Programming, revisited > I see. But |*args| does work just so long as you don't want > to _change the args_, doesn't it? It's possible (not tested) to change the members of *args, but not *args itself. > > > I'll have to look at the Object abuse again and get back > > > to you. > > So you're confining the context of excution, shutting out the > defining closure. Correct? It seems reasonable, though > couldn't one do that on their own if they wanted? Eg. > > class Foo < Struct.new(:aa, :bbb) > post_condition(:initialize) do > instance_eval do Doesn't work. You should have passed the object (the receiver of instance_eval) to the block. Which doesn't work nicely in combination with *args... > These parameter "abuses" certainly make particular uses more > succinct, but on the downside, they are more syntax to learn, > as opposed to being able to draw upon what one already knows > about Ruby. True. There's a lot of context switching below the surface. wrap_method and *_condition should take care of that. By default, the given block should behave as expected: It has its own context, as in plain Ruby. But you _could_ execute it in the context of the object (by passing Object). We can get rid of the abuse of Array, but it's just more common to see |*args| then |args|. What about this?: We could remove both abuses by passing both the arguments and the object: |args, obj|. Or even this: |args, block, obj|. (Which drags block into the game...) gegroet, Erik V. - http://www.erikveen.dds.nl/