std.traits.ParameterIdentifierTuple problem
Carl Sturtivant
sturtivant at gmail.com
Sat Mar 30 21:25:45 UTC 2024
On Saturday, 30 March 2024 at 21:07:35 UTC, Nick Treleaven wrote:
> On Saturday, 30 March 2024 at 19:23:07 UTC, Carl Sturtivant
> wrote:
>> $ dmd -c bug1.d
>> int(int num, string name, int)
>> ["", "", ""]
>> bug1.d(9): Error: static assert: "wrong!"
>> ```
>> Please explain. How do I get the names of the identifiers out
>> of a parameter list at compile time reliably?
>
> Although `.stringof` on a function type does include the
> parameter names, the names are not really part of the type -
> see:
> https://github.com/dlang/phobos/pull/3620#issuecomment-288469685
>
> Perhaps `ParameterIdentifierTuple` should give a compile error
> when given a function type.
OK, so how can I get them? Am I forced to take that string and
parse it with CTFE?
More information about the Digitalmars-d-learn
mailing list