Transform a function's body into a string for mixing in
Dennis
dkorpel at gmail.com
Thu Jun 20 20:38:48 UTC 2019
On Thursday, 20 June 2019 at 19:09:11 UTC, Emmanuelle wrote:
> Is there any trait or Phobos function for transforming a
> function/delegate/lambda/whatever's body into a string suitable
> for `mixin(...)`? For example:
See:
https://forum.dlang.org/post/kozwskltzidfnatbpjgb@forum.dlang.org
> If not, is there any way to do this _without_ using strings?
Depends on what you are trying to achieve with mixing in function
body code. If you just want to execute the function code, you can
just call it (obviously), so I assume you want dynamic scoping
(that global variables are overridden by local variables from the
caller) or something?
More information about the Digitalmars-d-learn
mailing list