<div class="gmail_quote">On 1 December 2010 01:18, 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">In the case of templates leading to some meta programming, it was an accident.</div>But in the case of operator overloading it seems just goodness.</div></blockquote><div><br></div><div>I am badly conflicted in the case of operator overloading. In its favour we have:</div>
<div><ul><li>more succinct code that clearly states intent (when overloaded properly)</li><li>opportunities to optimize calculations (like your example with intermediate forms for matrix manipulations)</li></ul></div><div>
Countering that favour, however, we have:</div><div><ul><li>idiots redefining operators in ways that are emphatically <b>not</b> proper in terms of semantics (<font class="Apple-style-span" face="'courier new', monospace">operator<<</font> and <font class="Apple-style-span" face="'courier new', monospace">operator>></font> being obvious cases, but also <font class="Apple-style-span" face="'courier new', monospace">operator+</font> for concatenation and some of the ... utterly painful uses for <font class="Apple-style-span" face="'courier new', monospace">operator,</font>)</li>
<li>the inability to define <b>new</b> operators (which leads to the first problem of idiots redefining the semantics of operators)</li><li>unexpected costs to operations making the eyeballing of execution complexity (time-wise and memory-wise) literally impossible</li>
<li>painful interaction with templates that makes a perfect storm of eye-damaging syntax</li></ul></div></div><br>-- <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>