<div class="gmail_quote">On 2 December 2010 14:53, Jay K <span dir="ltr"><<a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="im"> + for String really is ok.</div></div></blockquote><div><br></div><div>We will have to agree to disagree here. I really cannot stand having addition and concatenation using the same operator. It bugs me at a very profound level, even more than using left- and right-shift operators for output and input.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div> At this point, probably millions of programmers are comfortable<br> with + being concat. At least in statically typed systems,<br>
where 3 and "3" are clearly different.</div></blockquote><div><br></div><div>At this point millions of programmers are comfortable programming without a clean separation between interface and implementation. I still prefer the Modula series of languages and would not want them to change into an abortion like C++.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="im"> > Any token that consists of purely "special symbols" is an operator that<br>
> can be used directly as an operator<br> <br></div> This changes the meaning of existing code in both C/C++ and Modula-3.<br> <br> e.g.:<br> a:=+b;<br> a:=-b;<br> a:=--b;<br> a:=---b;<br></div></blockquote><div>
<br></div><div>I wasn't actually suggesting that we directly use Haskell's system. I was just pointing out that it's trivial to allow operators to be defined by the programmer without having the lexer communicating outside of the lexing process. It's a matter of language design.</div>
<div><br></div><div>Were I to retrofit a "define new operator" mechanism into an established language like Modula-3, I'd probably insist that user-added operators be wrapped in something like backquotes. So a hypothetical concatenation operator might become `++`. Basically user-defined operators would have to have some way to uniquely identify themselves as such to the lexer in the absence of a language built from scratch to support them.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div> Still, I think there is plenty value in overloading existing operators.<br></div></blockquote><div><br>
</div><div>There can be, yes. It's just that I've seen more abuse of operator overloading than I have good uses. This makes me nervous of having them, even though they <b>really are</b> damned convenient when used correctly.</div>
<div> </div></div>-- <br>"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."<br>
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.<br>