On Wed, 28 Sep 2005, Eric Mahurin wrote:

> Add another "p y" and you'll see y wasn't localized in the block.  The block
> just caused y to be assigned to x.


you are right - i'd forgotten about that...


> What I'm asking is this:
>
> f =3D nil
> y =3D 1
> localize { |y| # localize y and call this block
>  y =3D 2
>  f =3D lambda { y }
> }
> p y           # =3D> 1
> p f.call      # =3D> 2
> y =3D 3
> p y           # =3D> 3
> p f.call      # =3D> 2
>
> Anyway to get this functionality?
>
> If block arguments were always made local (regardless of
> whether that variable was assigned yet or not), we could have
> done this to be the equivalent of the above localize:
>
> lambda { |y|
>  y =3D 2
>  f =3D lambda {y}
> }.call(nil)

i think you would have to do the black magic for this to work - i've asked for
it myself before...

btw.  you mailer munges your posts pretty bad - i get them as they appear
above.

cheers.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================