But if “__var” is ugly, then IMO so is “@__var”. Does Matz still
consider to use “@_var” or “@__var” for class private variables? Or
has even the concept of creation of class private variables been
abandoned altogether?
In message “Too Many Underscores?” on 02/10/09, Bill Tj billtj@glue.umd.edu writes:
But if “__var” is ugly, then IMO so is “@__var”. Does Matz still
consider to use “@_var” or “@__var” for class private variables? Or
has even the concept of creation of class private variables been
abandoned altogether?
I’m still positive about class private (or class local) variable.
IMO, “__var” can be seen as “__var”, whereas “@var" can be seen as
"@” (prefix) + “var”.
But if “__var” is ugly, then IMO so is “@__var”. Does Matz still
consider to use “@_var” or “@__var” for class private variables? Or
has even the concept of creation of class private variables been
abandoned altogether?
Regards,
Bill
It’s just my opinion/taste; I just dislike underscores as meaningful
identifiers. I have a rational justification: underscores are “just another
letter” in identifiers; using them as special at the beginning of an
identifier is, err, inconsistent.
Also, underscores are meant to represent spaces. Do you really
want your Ruby code to look like this?
For one, I did routinely mark my C++ private variables
as __something, exactly to make them look ugly enough
so I won’t touch them, ever, only from similarly ugly member
functions, also marked with underscores, like __func().
It worked very well for me. Perhaps that was one of the
features of C++ I liked best…
However, using 3 characters for variable markup (like @__) can be too much, indeed. (Well, at least it does sound like absolutely too much, but practice may prove
it otherwise, I’m not convinced of either case.)
Sab
···
----- Original Message -----
From: “Gavin Sinclair” gsinclair@soyabean.com.au
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, October 10, 2002 2:16 AM
Subject: Re: Too Many Underscores?
But if “__var” is ugly, then IMO so is “@__var”. Does Matz still
consider to use “@_var” or “@__var” for class private variables? Or
has even the concept of creation of class private variables been
abandoned altogether?
Regards,
Bill
It’s just my opinion/taste; I just dislike underscores as meaningful
identifiers. I have a rational justification: underscores are “just another
letter” in identifiers; using them as special at the beginning of an
identifier is, err, inconsistent.
Also, underscores are meant to represent spaces. Do you really
want your Ruby code to look like this?
Thu, 10 Oct 2002 09:29:06 +0900, Szabolcs Szasz sz@szasz.hu pisze:
For one, I did routinely mark my C++ private variables
as __something, exactly to make them look ugly enough
so I won’t touch them, ever, only from similarly ugly member
functions, also marked with underscores, like __func().
This is illegal: all identifiers containing double underscore are
reserved for a C++ implementation.
Oops, indeed! :-o (But I’m a lucky guy, after all…)
So even that __ was something C++ did not give but
tried to take away…
Sab
···
Thu, 10 Oct 2002 09:29:06 +0900, Szabolcs Szasz sz@szasz.hu pisze:
For one, I did routinely mark my C++ private variables
as __something, exactly to make them look ugly enough
so I won’t touch them, ever, only from similarly ugly member
functions, also marked with underscores, like __func().
This is illegal: all identifiers containing double underscore are
reserved for a C++ implementation.