Re: hasUDA with this

2018-07-26 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2018 09:24 AM, jmh530 wrote: > On Thursday, 26 July 2018 at 08:08:17 UTC, Timoses wrote: >> On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote: >> Regarding this example >> >> void fun() { >> /*const*/ >> { >> double bar; >> } >> >> static assert(!is (typeof

Re: hasUDA with this

2018-07-26 Thread jmh530 via Digitalmars-d-learn
On Thursday, 26 July 2018 at 08:08:17 UTC, Timoses wrote: On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote: On Friday, 20 July 2018 at 18:24:11 UTC, Timoses wrote: (snip) I don't think that bug report relates to the initial question (UDA not applying to run-time instance). True. Bu

Re: trait to get the body code of a function?

2018-07-26 Thread Mr.Bingo via Digitalmars-d-learn
On Thursday, 26 July 2018 at 13:27:09 UTC, Alex wrote: On Thursday, 26 July 2018 at 11:54:39 UTC, Mr.Bingo wrote: The string itself could be useful however... Whatever OP has in mind with this string... Having a code block is useful in many ways simply because not having it is the most limi

Re: trait to get the body code of a function?

2018-07-26 Thread Seb via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 19:10:03 UTC, 12345swordy wrote: On Wednesday, 25 July 2018 at 19:05:08 UTC, Guillaume Lathoud wrote: On Wednesday, 25 July 2018 at 04:46:20 UTC, rikki cattermole wrote: On 25/07/2018 5:32 AM, Guillaume Lathoud wrote: Thanks for all the answers. I've just had a loo

Re: trait to get the body code of a function?

2018-07-26 Thread Alex via Digitalmars-d-learn
On Thursday, 26 July 2018 at 11:54:39 UTC, Mr.Bingo wrote: The string itself could be useful however... Whatever OP has in mind with this string... Having a code block is useful in many ways simply because not having it is the most limiting case. If one doesn't have it and requires it then

Re: trait to get the body code of a function?

2018-07-26 Thread Mr.Bingo via Digitalmars-d-learn
On Thursday, 26 July 2018 at 10:20:04 UTC, Alex wrote: 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

Re: trait to get the body code of a function?

2018-07-26 Thread Alex via Digitalmars-d-learn
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 funct

Re: hasUDA with this

2018-07-26 Thread Timoses via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote: On Friday, 20 July 2018 at 18:24:11 UTC, Timoses wrote: [snip] It works in module scope https://run.dlang.io/is/OQKYag I don't know why though... This was reported in 2013. IMO, it should be mentioned in the spec if they don't plan

Re: trait to get the body code of a function?

2018-07-26 Thread Mr.Bingo via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 04:43:33 UTC, Guillaume Lathoud wrote: Hello, __traits and std.traits already offer access to function information like input parameters, e.g. in std.traits: ParameterIdentifierTuple ParameterStorageClassTuple Even if that might sound strange, is there a compile t