On Thursday, 26 July 2018 at 07:32:19 UTC, Mr.Bingo wrote:
If all you need is the string you can write a template function
that imports the file and searches for the function and returns
it's body.
It's not very robust but it can work for some cases. D really
should allow one to get the function body in D, possibly in a
type safe way(such as each line is parsed properly and return
type info about what the line contains.
I would argue, just because of "type safety" you mentioned, D
should not allow one to get the function body. The type safety is
not achievable because of
https://en.wikipedia.org/wiki/Lambda_calculus#Undecidability_of_equivalence
The string itself could be useful however... Whatever OP has in
mind with this string...