Full closures for D

Frank Benoit keinfarbton at googlemail.com
Sun Nov 11 09:13:17 PST 2007


the lazy keyword was introduced with a hint to the logging use case.
"Save the performance of evaluating the string if logging is disabled."

  void log( lazy char[] msg ){ ... }

  ...
  char[] str = f();
  log( "my message: "~str );

With full closures, is this an implicit "taking an address of a local
function" that triggers a heap allocated stack frame?

If yes, the stack frame is allocated without the need for. this would be
counter productive in the logging use case.

If no, everything is perfect i think. :)




More information about the Digitalmars-d mailing list