Possible enhancement: Concise return statements

Walter Bright newshound2 at digitalmars.com
Mon Aug 15 14:42:17 PDT 2011


On 8/15/2011 2:00 PM, Jonathan M Davis wrote:
> It would be a big problem with regard to functions in general IMHO, but how do
> struct destructors and overloading apply to lambdas? It at least _seems_ like
> it would be possible to make it so that single-statement lambdas which have no
> return or ; but return the result of that statement would work without any
> ambiguities.

Struct destructors and postblits execute arbitrary code. A function returning 
such a struct would build the return value in the caller's stack.

Overloading comes when a lambda is passed as a template argument, becoming a 
function pointer, which is then used as an argument to an overloaded function.



More information about the Digitalmars-d mailing list