From: "Stathy G. Touloumis" Date: 2002-10-03T04:10:02+09:00 Subject: Re: bugs At 03:34 AM 10/3/2002 +0900, you wrote: > >> >> k='Hello' > >> >> [1,2,3].map {|k| k} > >> >> puts k > >> >> It prints 3 under ruby1! > >> >Yes, using block argument equals to assignment to it. > >>But shouldn't it be local to the block? It may cause nice errors... > >>If it is available outside the block, it is a Bad Idea(tm). > >This is an issue discussed previously on this list as well as feature > >enhancements to Ruby in future versions if I am not mistaken. In the above > >code k is defined outside the code block and that is why it's assignment > >within the code block is retained outside of it. > >So it won't change in the future? Unfortunately, I haven't been using Ruby that long but again noticed the topic discussed. I am sure it is preferable to have a 'local' context as would be expected but it can affect older code. I have confidence that the individuals running the Ruby show will come up with something to satisfy us all : )