Logan Capaldo wrote:
> On Oct 9, 2005, at 11:31 PM, Trans wrote:
>
> >
> > Logan Capaldo wrote:
> >
> >
> >> really don't believe thats necessary. Can anyone come up with a use
> >> for an eval taking a string that CAN'T be acheieved by an eval that
> >> takes a block? (well, irb I suppose).
> >>
> >
> > No closure.
> >
> > T.
> >
> >
> >
>
> Yes, but if eval only took a block the closure could be over exactly
> what was referenced in the block instead of (relatively) everything.
>
> eg.
>
> x = 2
> lambda { eval("y = 2; puts y") }.call # x is in the closure
>
> vs.
>
> x = 2
>
> eval { y = 2; puts y } # x isn't in the closure cause its guaranteed
> not to reference it

But I don't know if you'd want to do that in general. I don't know,
Maybe it could work, but getting rid of eval strings is a big
compatability breaker --and using the dynamic methods in their place
are not nearly as concise. Wouldn;t it be easier just to have an
alternate explict notation to trigger your propsed behavior? I'm all
for it, I just think that's probably the best way to do it --if a good
notaiton can be had.

T.