On Friday, 4 April 2014 at 01:14:37 UTC, Meta wrote:
A more interesting point of his is the limitation of Scala's ability to optimize functions like filter... This is also a problem in D, but not as visible as we do not have macros to perform the sort of transformation he describes (turning filter f1, filter f2, filter f3 into filter f1 f2 f3). Maybe we should think about enforcing that lambas passed to higher order functions are pure, when we can (not in the compiler, of course. In the library.)


And unfortunately, his next example also compiles in D. At least D has some rationale for allowing this in the fact that it's a systems-level language, but this is still awful.


import std.stdio;

void main()
{
        float f = long.max;
        int n = int.max;
        auto x = f - n;
        writeln(typeof(x).stringof, " ", x);
}

Reply via email to