There are various problems with auto functions in general, so it may well be that you cannot do
void main()
{
auto bar() { return "hello world"; }
writeln(bar());
}
due to a mistake with the car, and not due to the fact that it was designed. I'm not sure what these exact plans are, although I would have thought that you should use auto as the return type of a nested function. In this case, there is a request for improvement on it .
However, regardless of whether auto works with nested functions, you can declare a delegate in the same way:
void main()
{
auto bar = () { return "hello world"; };
writeln(bar());
}
, , , , .