From: Jim Weirich Date: 2004-04-24T03:48:34+09:00 Subject: Re: Creating bang methods Jean-Hugues ROBERT said: > I agree that > 1 += 1 > does not make much sense, yet > x = 1 > x += 1 > does make some sense. > I am not advocating for special cases when I assume that some kind > of lvalue exists, or am I ? Just like +=, ++ can not be defined as a method on an object. But you are correct that there is no /technical/ reason preventing ++a from being treated an abbreviation for a=a+1. However, one must balance the advantages against the disadvantages. Does the convenience make up for the complexity of yet more special syntax. Does it fit well with the rest of the language? (for example: += works well with strings, what should ++ do with strings? What should ++ do with time values: increment by an hour, a minute, a second, a day?). In this matter of balance, everyone will weigh the sides differently. So far, Matz has decided that the convenience of saving one character doesn't balance the extra complexity involved. So be it. Many people agree, some people dont'. I can live with that (and I'm glad it is Matz deciding and not me!). -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)