Interesting rant about Scala's issues

Marc Schütz" <schuetzm at gmx.net> Marc Schütz" <schuetzm at gmx.net>
Sat Apr 5 07:36:02 PDT 2014


On Friday, 4 April 2014 at 01:54:16 UTC, Ben Boeckel wrote:
> There is *zero* rationale as to why this would be a compilable
> implementation of comparison:
>
>     int compare(int a, int b) {
>         return a * b;
>     }
>
> The fact that this compiles when used as a comparison is 
> *insane* when
> you take a fresh look at how you can construct a language.

You're actually not restricted to int; you can also return float, 
or in fact any type that's compare to 0, including user-defined 
types that implement their own `opCmp`.


More information about the Digitalmars-d-announce mailing list