Operator overloading for non-value objects

Kevin Smith zenparsing at gmail.com
Tue Jan 14 11:37:01 PST 2014


>
>
> If power users would like to compare via == when they are aware of
> operator overload for used classes then I don't see any problem.
>
>
If you know the operand types already, then there's no problem.  But in
cases where you don't control the operand types how will you know the
semantics that "==" will provide?  What does the following mean?

    if (maybeCollection1 == maybeCollection2) { ... }


> Operators overload worked for power users in many other languages and I
> think if not abused it can be very handy.
>

In general, I agree.  But in the specific case of "==" I'm not sure we have
a solid foundation to build upon.  How do you meaningfully overload a
language element that, arguably, carries no useful meaning?


>
> Once again, just my 2 cents
>

Mine too - we need to wait for a proposal before going any further.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140114/cae1db8b/attachment-0001.html>


More information about the es-discuss mailing list