Pure higher order functions
bearophile
bearophileHUGS at lycos.com
Fri Jul 8 16:22:00 PDT 2011
Jonathan M Davis:
> Regardless, the overall situation with purity is improving.
I agree. Someday I hope to see another little improvement in the D type system, to allow code like this to compile without the need of a cast of s2 to string at the end:
string foo(in string s) pure nothrow { // strongly pure
char[] s2 = s.dup; // dup will become nothrow
s2[0] = 'A';
return s2;
}
(alternative design of this feature: this foo returns a char[] but then you are allowed to assign this result to a string).
Seeing the recent large amount of pull requests I am seeing, is someone willing to implement this type system feature?
Bye,
bearophile
More information about the Digitalmars-d
mailing list