Using traits how do i get a function's parameters as a string?

Adam D. Ruppe destructionator at gmail.com
Tue Sep 3 14:11:27 PDT 2013


On Tuesday, 3 September 2013 at 21:01:27 UTC, Gary Willoughby 
wrote:
> Using traits how do i get a methods's parameters as a string? 
> Say i have the following method:

Use typeof(setAge).stringof to get something you can then parse 
to fet the names.

My web.d has a function to do it:

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/web.d#L1912

InfoImpl is here:

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/web.d#L1956

It gets typeof(func).stringof then does a rudimentary parsing to 
get the argument names and default values out as arrays of 
strings.


More information about the Digitalmars-d-learn mailing list