Re: Get body of a function as string

2013-07-04 Thread JS
On Saturday, 29 June 2013 at 10:38:57 UTC, bearophile wrote: Jacob Carlborg: I remember someone someone modified DMD and added a .codeof property or similar. It was fairly easy. If there are enough use cases for it, then perhaps it's worth putting both the enhancement request for .codeof

Re: Get body of a function as string

2013-06-29 Thread Namespace
Oh, hey! I remember participating in writing some of that :) Only Involved? You've written it. I've added only a few things. :)

Re: Get body of a function as string

2013-06-29 Thread Jacob Carlborg
On 2013-06-28 14:46, John Colvin wrote: Is there any way of getting the body of a function as a string? (Obviously only when the source code is available to the compiler) I remember someone someone modified DMD and added a .codeof property or similar. It was fairly easy. -- /Jacob Carlborg

Re: Get body of a function as string

2013-06-29 Thread bearophile
Jacob Carlborg: I remember someone someone modified DMD and added a .codeof property or similar. It was fairly easy. If there are enough use cases for it, then perhaps it's worth putting both the enhancement request for .codeof and its relative patch in Bugzilla. Bye, bearophile

Get body of a function as string

2013-06-28 Thread John Colvin
Is there any way of getting the body of a function as a string? (Obviously only when the source code is available to the compiler)

Re: Get body of a function as string

2013-06-28 Thread bearophile
John Colvin: Is there any way of getting the body of a function as a string? (Obviously only when the source code is available to the compiler) I think that currently there isn't a simple way to do it. What is your use case? Bye, bearophile

Re: Get body of a function as string

2013-06-28 Thread John Colvin
On Friday, 28 June 2013 at 13:18:39 UTC, bearophile wrote: John Colvin: Is there any way of getting the body of a function as a string? (Obviously only when the source code is available to the compiler) I think that currently there isn't a simple way to do it. What is your use case? Bye,

Re: Get body of a function as string

2013-06-28 Thread Namespace
And why don't you call the function from your clone function? Maybe this could help you: http://dpaste.1azy.net/fork/597affd2 I used it to generate my own rvalue functions because of the lack of rvalue references.

Re: Get body of a function as string

2013-06-28 Thread John Colvin
On Friday, 28 June 2013 at 13:55:54 UTC, Namespace wrote: And why don't you call the function from your clone function? Because the body of the new function needs to see the parameters as known at compile-time. Maybe this could help you: http://dpaste.1azy.net/fork/597affd2 I used it to

Re: Get body of a function as string

2013-06-28 Thread bearophile
John Colvin: Because the body of the new function needs to see the parameters as known at compile-time. I think to curry a function all you need to know is its signature. And in std.traits probably there is all the functionality to see all kinds of function arguments, their names, tags,

Re: Get body of a function as string

2013-06-28 Thread monarch_dodra
On Friday, 28 June 2013 at 20:50:55 UTC, John Colvin wrote: On Friday, 28 June 2013 at 13:55:54 UTC, Namespace wrote: And why don't you call the function from your clone function? Because the body of the new function needs to see the parameters as known at compile-time. Maybe this could