From: dblack@... Date: 2002-09-14T05:35:16+09:00 Subject: Re: private variables Hi -- On Sat, 14 Sep 2002, Kent Dahl wrote: > > 2) The use of a new symbol. > > Ruby is to some extent influenced by Perl, and in Perl "$", "@", and > > "%" are used to denote the type of variables. Ruby has used "$" and > > "@" for special meaning for variables, so this suggests to use "%" prefix > > for private variables. > > IIRC, neither of $ or @ are used as operators, but % is modulus in Ruby. > I can't think of any case where it would not be backwards compatible, > but I think it looks confusing: > a = b%c # b modulus c > a = b %c # call method b with one argument; private variable c > But then, perhaps we have enough training dealing with this confusion > due to things like a +5 versus a+5... Here's an non-backwards compatible case: %q__ = "some private thing" a = %q__ What's the value of a at this point? > Now, earlier when the talk of local variables came up, I noticed the � > sign sitting to the left of the $ on my keyboard. The pound sign almost > looks like a L too! (L for local. ) Or maybe even �, which looks like to > S's (supersecret perhaps). Don't take these ideas too serious though. I > do not prefer to program in ASCII art. :-) I was musing before on '#', which has a secretive/private connotation, as a variable prefix :-) Thinking about these things makes one increasingly grateful for the non-punctuation-riddenness of Ruby. David -- David Alan Black | Register for RubyConf 2002! home: dblack@candle.superlink.net | November 1-3 work: blackdav@shu.edu | Seattle, WA, USA Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com