dmd 2.068 deducing purity
Jack Applegame via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 25 06:59:43 PDT 2015
Using lambdas in 2.068 becomes painful:
>import std.algorithm;
>
>struct Foo {
> int baz(int v) {
> static int id;
> return v + id++;
> }
> void bar() {
> auto arr1 = [1, 2, 3];
> auto arr2 = [4, 5, 6];
> arr1.map!(i =>
> arr2.map!(j => baz(i + j))
> );
> }
>}
>
>void main() {
>}
>Error: pure function
>'bug.Foo.bar.__lambda1!int.__lambda1.__lambda2' cannot call
>impure function 'bug.Foo.baz'
Also after switching to dmd 2.068 I got many stupid errors in
lambdas (defined inside class non-static functions):
>Error: need 'this' for '...' of type '...'
I have no idea how to fix it and had to go back to 2.067.
More information about the Digitalmars-d-learn
mailing list