On 2015-06-06 08:59, Jonathan M Davis wrote:
On Saturday, 6 June 2015 at 06:16:17 UTC, Andrei Alexandrescu wrote:
Nested functions that allocate their environment dynamically can be
quite useful. However, oftentimes the need is to convert the code plus
the data needed into an anonymous struct that copies the state inside,
similar to C++ lambdas that capture by value.

I wonder how to integrate that within the language nicely.

Some of us were discussing this at dconf. Essentially, we need a way to
create a functor similar to how C++ lambdas do. The most straightforward
way would involve string mixins, and you'd do something like

auto f = makeFunctor!"function code here"(arguments);

Which could look like this with AST macros ;)

auto f = makeFunctor(args) {
   function code goes here, no strings are needed
}

--
/Jacob Carlborg

Reply via email to