From: Leo Razoumov Date: 2001-03-09T05:10:02+09:00 Subject: [ruby-talk:12297] Re: FEATURE REQUEST: 'my' local variables >>>>> "BT" == Ben Tilly writes: BT> And so I still absolutely think you are wrong that it is BT> bad to have the concept of being able to say that this, BT> here, is a private variable that shall forevermore be BT> private no matter what else is in scope. An example why not BT> having it is a bad idea, when constructing strings or blocks BT> that will be evalled in someone else's context, it is good BT> for both you and them that you have the ability to within BT> this section declare certain variables as private to your BT> code and be able to limit how you will interact with their BT> code without having to examine it. Thank you for emphasizing my point once again. Indeed, encapsulation properties of a language should not depend on the way a programmer chooses the names for his local variables. And we all beleive in the power of encapsulation in OO languages, don't we!! BT> Absolutely none of the examples that you have presented has BT> shaken my belief that private temporary variables, a concept BT> that is available in most decent languages, would be an BT> unnecessary obfuscation in Ruby. I use them religiously BT> when they are available. It is true that 99% of the time BT> they accomplish absolutely nothing, but I am glad that I will BT> never find out which 1% of the time I saved myself a nasty BT> headache... BT> Cheers, BT> Ben Correct! I am a bit surprised that my original posting caused so much a discussion on this topic with a lot of people expressing their opposition to this concept. I must admit my choice of 'my' brought negative associatins with Perl which clearly hurt the discussion. Let's take Lisp or Scheme. These languages have a scoping construct (let (put_your_locals_here) body_of_the_block) which does exactly what I want and without Perl bugs. By the way, even C has this kind of behaviour (I can declare locals with no regards to other locals on outer scopes). I really do not see the reason to oppose this feature unless implementation is very compicated (it should not be). --Leo