digitalmars.D.learn - where is parameterNames?
- Ellery Newcomer <ellery-newcomer utulsa.edu> Aug 13 2012
- Jonathan M Davis <jmdavisProg gmx.com> Aug 13 2012
- Ellery Newcomer <ellery-newcomer utulsa.edu> Aug 13 2012
- "bearophile" <bearophileHUGS lycos.com> Aug 14 2012
- Jacob Carlborg <doob me.com> Aug 14 2012
- "David Nadlinger" <see klickverbot.at> Aug 14 2012
- Jacob Carlborg <doob me.com> Aug 14 2012
- "David Nadlinger" <see klickverbot.at> Aug 15 2012
- Ellery Newcomer <ellery-newcomer utulsa.edu> Aug 19 2012
- Philippe Sigaud <philippe.sigaud gmail.com> Aug 15 2012
pragma(msg, __traits(parameterNames, Constructors[0])); gives me tok.d(19): Error: unrecognized trait parameterNames
Aug 13 2012
On Monday, August 13, 2012 21:40:48 Ellery Newcomer wrote:pragma(msg, __traits(parameterNames, Constructors[0])); gives me tok.d(19): Error: unrecognized trait parameterNames
Parameter names aren't part of a function's API. Why would you need them? - Jonathan M Davis
Aug 13 2012
On 08/13/2012 09:49 PM, Jonathan M Davis wrote:On Monday, August 13, 2012 21:40:48 Ellery Newcomer wrote:pragma(msg, __traits(parameterNames, Constructors[0])); gives me tok.d(19): Error: unrecognized trait parameterNames
Parameter names aren't part of a function's API. Why would you need them? - Jonathan M Davis
I was thinking about adding keyword argument support to pyd wrapped functions.
Aug 13 2012
Ellery Newcomer:I was thinking about adding keyword argument support to pyd wrapped functions.
Maybe you have to process the JSON output? Bye, bearophile
Aug 14 2012
On 2012-08-14 06:40, Ellery Newcomer wrote:pragma(msg, __traits(parameterNames, Constructors[0])); gives me tok.d(19): Error: unrecognized trait parameterNames
I don't know if this works any better: https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29 It's a simple implementation. I also have a function which also you to call another function using named arguments: https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L135 Neither of these two support delegate parameters. -- /Jacob Carlborg
Aug 14 2012
On Tuesday, 14 August 2012 at 16:06:33 UTC, Jacob Carlborg wrote:I don't know if this works any better: https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29 It's a simple implementation.
Nice hack, but when using this on functions you don't control, be aware that parameter names are officially not considered part of the API (as it became clear in the named parameter-related discussions). This implies that e.g. the parameter names of Phobos functions might change at any time. David
Aug 14 2012
On 2012-08-14 20:29, David Nadlinger wrote:Nice hack, but when using this on functions you don't control, be aware that parameter names are officially not considered part of the API (as it became clear in the named parameter-related discussions). This implies that e.g. the parameter names of Phobos functions might change at any time.
Of course, this was more a "just because it's possible". -- /Jacob Carlborg
Aug 14 2012
On Tuesday, 14 August 2012 at 16:06:33 UTC, Jacob Carlborg wrote:https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29
Related: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L510 David
Aug 15 2012
On 08/15/2012 09:46 AM, David Nadlinger wrote:Related: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L510 David
That should work nicely. Why does it not show up on dlang.org?
Aug 19 2012
On Wed, Aug 15, 2012 at 6:46 PM, David Nadlinger <see klickverbot.at> wrote:On Tuesday, 14 August 2012 at 16:06:33 UTC, Jacob Carlborg wrote:https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29
Related: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L510
Hmm: static if (is(typeof(func[0]) PT == __parameters)) __parameters is a new feature in is()' treasure vault, right? Testing it, it seems to return the parameter tuple of a function. That's cool. However, that'd be cooler if it was documented somewhere. Was that in 2.060 changelog?
Aug 15 2012









Ellery Newcomer <ellery-newcomer utulsa.edu> 