From: "James Britt (rubydev)" Date: 2002-02-03T06:51:11+09:00 Subject: RE: Variable types > On Sun, 3 Feb 2002, David Corbin wrote: > > > I know I'm new to ruby, but I feel obligated to share my dislike for > > "special symbols" to indicate if a symbol is a member, local variable or > > global variable. Perhaps I don't know enough to make such a comment, > > and someone will show me my mistunderstanding. > > > > Anyone else think like I do? > > I sort of like $ for global variables because it makes it easy to > tell where you've used them and therefore need to rewrite your > code :-) I'm a little put off by required prefixes; it's basically the language forcing you to use a particular coding style. It's perhaps not as bad as telling you how to use white space, but in the same realm. On the other hand, these prefixes allow you to create, say, a global variable wherever you like, obviating the normal scoping rules: #------------------------- def foo s $g ||= s end def bar puts $g || "not set" end bar # prints "not set" foo "Good" bar # prints "Good" #------------------------- James > > > David