3.9 underscore still there?
andreas.raab at gmx.de
Mon Oct 30 20:18:13 UTC 2006
Bill Schwab wrote:
> My preference would be for ANSI compatibility. With that said, having
> underscored in selectors, and even just all but the first slot, would do
> almost everying I need. I doubt I use them in variable names, and if I
> do, I could change it. If I were to move my production code to Squeak,
> I would be editing a lot more than a few variable names. Most of uses
> of underscores are matching the outside world, and that is not so
> readily altered to suit my whim or Squeak's limitations.
If all you want to do is to get your code going in Squeak, a fairly
simple alternative is to subclass the current parser/compiler, apply
Ian's patch and use those for loading your own classes. It ain't exactly
a great solution but may be helpful in the short term.
> If we can get
> Ian's fix in the mainstream, it would be greatly appreciated.
This is one of these situations where a little more thought is in order
because there are both short-term and long-term implications. Consider
an example like this:
c_a call: b.
Depending on the interpretation of underscore we have 3 possibilities:
1) Underscore means assignment: The above is a legal expression.
2) Underscore is a letter: The above is a legal, too.
3) Underscore is a letter in selectors except if first, and invalid for
variable names: The above is illegal.
So in two out of three interpretations the above is legal, only in the
last one it is not. What troubles me here is that while it may be an
okay solution in the short term to put the burden on the user of the
underscore (e.g., basically saying "if you use underscores you need to
understand where exactly you can use them and where not") the
inconsistency and complexity inherent in the description that
"underscores are treated as letters in selectors unless they are the
first character and cannot be used in variable names" strikes me as a
*very* poor choice in the long term.
I'd rather do something where (based on some meta-annotations) the
parser can decide whether to to treat underscores as assignments or as
letters and possibly rewrite them on the fly. The essential idea being
that legacy code (using underscore as assignments) can still be loaded
into a later version.
More information about the Squeak-dev