Compiler errors and recursive nested functions
Dylan Knutson
tcdknutson at gmail.com
Wed Jun 12 15:45:50 PDT 2013
Hello! I'm trying to make a deepMap function which operates on
the deepest non-range element of an array. I think that this
function should theoretically work, however there are some
compiler errors that I can't quite understand.
Here's the code: http://dpaste.dzfl.pl/97918311
And the compiler error because DPaste's compiler service seems to
be offline:
src\algorithm_util.d(26): Error: function
algorithm_util.__unittestL34_5.deepMap!(__lambda4, int[]).deepMap
is a nested function and cannot be accessed from
algorithm_util.__unittestL34_5.deepMap!(__lambda4,
int[][]).deepMap.__lambda2300!(int[]).__lambda2300DMD
v2.064 DEBUG
deepMap works just fine if I pass in an array that isn't nested,
so this will work:
auto a = [1, 2, 3];
auto b = a.deepMap!(a => a + 1)();
writeln(b);
// "[2, 3, 4]"
Can someone explain what is going on?
Thank you,
Dylan Knutson
More information about the Digitalmars-d-learn
mailing list