From: dblack@... Date: 2002-08-10T13:50:21+09:00 Subject: Re: ambiguity between local variable assignment and writter method Hi -- On Sat, 10 Aug 2002, Tom Sawyer wrote: > does anyone else find it annoying that local variable assignment is > indistinguishable from a writter method. (Not ignoring the rest of the thread -- just wanted to comment on the underlying question.) At first, I found it to be a minor but noticeable fly in the ointment. However, I've come to think it's a small price to pay, Cons: 1. you have to type what feels like an "extra" "self". Pros: 1. in Ruby, you get to leave "self" off a lot, so having it not be 100% of the time isn't so bad. One can think of it as: you have to specify the receiver, except where it's clear without it, and it's clear without it much of the time (which I like). 2. The "self.thing = x" form is, ultimately, completely consistent with Ruby syntax in general; we're not being asked to do something anomalous. Even though this is a special case, it's not special syntax. It's just disambiguation. 3. It's one of the rites of passage into Ruby to have to master this, sort of like realizing that #{...} can interpolate more than just single variables :-) Follow-up to #2: for that reason (i.e., providing a receiver is normal Ruby syntax), I'd rather it were left like this than that any new construct were added to avoid it. That seems like a potentially never-ending spiral: define syntax; where it's ambiguous, instead of requiring strict/explicit usage *within* the syntax, introduce a new construct; eventually, something will crop up with the new construct that requires disambiguation; create new syntax for that... etc. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav