Transform a function's body into a string for mixing in

Emmanuelle VuLXn6DBW at PPtUm7TvV6nsw.com
Thu Jun 20 19:09:11 UTC 2019


Hello!

Is there any trait or Phobos function for transforming a 
function/delegate/lambda/whatever's body into a string suitable 
for `mixin(...)`? For example:

---
__traits(getBody, (int a, int b) => a + b); // returns "(int a, 
int b) => a + b"
                                             // or maybe just "a + 
b"
---

If not, is there any way to do this _without_ using strings? They 
are very inconvenient and could hide errors.

Thanks!


More information about the Digitalmars-d-learn mailing list