So, I wanted to wrap my head a little tighter around those strange animals that are lamdas.

I wrote the simpliest program utilizing a lambda :

import std.stdio;
void main(){
        writeln({return "foobar";});
}

and it yields 43106C, which does not look like "foobar" at all, but rather, I suspect, like a pointer or something.
So I tried
       writeln(typeid({return "foobar";}));
which in turn yelds immutable(char)[]()*
that hints further to a pointer.
I get the immutable(char)[] : an immutable array of characters, why not. But I really don"t get the set of parens between the square brackets and the asterisk. Could that mean that what I get is in fact a pointer to a function ? (said function having no arguments, or having void as sole argument or ...)

Now, the question (and the very point of a lambda if I get it right) would be to get this function to evaluate (and precisely return the string "foobar" in this example).

What syntactic subtility am I missing ?

Reply via email to