Yukihiro Matsumoto wrote:
> 
> Hi,
> 
> In message "[ruby-talk:12615] Re: Order, chaos, and change requests :)"
>     on 01/03/14, Leo Razoumov <see_signature / 127.0.0.1> writes:
> 
> |n  = 0
> |my = 1
> |(1..100).each \
> |{
> |  <my,local,vars,declared,here>
> |  |n|
> |  my += n
> |  # ....
> |}
> |n  # -> 10  #side effect, 'n' was overriden within the block
> |my # -> 1   #still old value, not affected by block-local var. of the same name
> 
> I like this except that I feel name duplication like the following is
> little bit messy.
> 
>   array.each {<i>|i|...}
> 

hmm..

What about this:

array.each {<|i|> .... }

More generally, allow < > to declare as block-local all or part 
of the parameter list in addition to regular variables.

{|a,b|  ....  }
{|a| <|b|>  ....  }  # makes one of the parameters block-local
{|a,b| <x,y>  .... }  # specifies block-locals
{|a| <|b|,x,y>  .... }
{<|a,b|>  .... }
{<|a,b|,x,y>  .... }

As far as my post in ruby-talk:12563, this approach would handle
the 'shadowed parameters' and 'imports', but not the 'exports'.


Guy N. Hurst

-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript