From: "Florian Groß" Date: 2005-08-06T14:03:43+09:00 Subject: Re: operator overloading (was: new block notation) Caleb Clausen wrote: >>Yes, nice analogy ;-). However, there's a difference between change and >>plain misuse; operator overloading in C++ comes to mind, > > Ruby lets you override operators too. In fact, you could say in some > ways it's worse than C++ in this respect, since you can change the > meaning of adding two integers in ruby.... > > I used to believe in very careful operator overloading, and only when > it preserves the axioms of arithmetic. I disapproved of this: > "foo"+"bar", because it does not meet that criterion. (Tho I > recognized that it could be a useful special case.) > > That was before I invented Reg. Getting what I wanted to do done > compactly with pure ruby required giving something up, and that > something was operator overloading. Reg can definitely be said to be > ahh, unorthodox in the extensive use of operators that it makes. And I > wouldn't have it any other way. Which shows an important fact: Pragmatism wins. Same for Ruby allowing you to call private methods and to add new methods to everything. Same for the English language letting you introduce new usage for existing words or combinations of words or introducing new meaning to combinations of letters.