Thread overview | ||||||
---|---|---|---|---|---|---|
|
November 30, 2018 Incorrect ParameterIdentifierTuple results? | ||||
---|---|---|---|---|
| ||||
ParameterIdentifierTuple produces different results depending on whether unnamed parameters are built-in types or user types. struct SomeType { void wrong(SomeType) {} void right(int) {} } ParameterIdentifierTuple!(__traits(getMember, SomeType, "wrong")); // tuple("SomeType") ParameterIdentifierTuple!(__traits(getMember, SomeType, "right")); // tuple("") Is this the intended behaviour? Shouldn't it just return empty strings in both cases? What would be the benefit of returning user type names? |
November 30, 2018 Re: Incorrect ParameterIdentifierTuple results? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Chapman | On Fri, 30 Nov 2018 18:18:36 +0000, John Chapman wrote:
> ParameterIdentifierTuple!(__traits(getMember, SomeType, "wrong"));
> // tuple("SomeType")
> ParameterIdentifierTuple!(__traits(getMember, SomeType, "right"));
> // tuple("")
Compiler and version would be helpful here.
I'm on DMD 2.081.1 and it yields the same results in each case: _param_0
|
November 30, 2018 Re: Incorrect ParameterIdentifierTuple results? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Neia Neutuladh | On Friday, 30 November 2018 at 19:07:14 UTC, Neia Neutuladh wrote:
> Compiler and version would be helpful here.
>
> I'm on DMD 2.081.1 and it yields the same results in each case: _param_0
Hmm, I was calling ParameterIdentifierTuple inside a lambda - once I moved it into my main function I got the same output as you.
But … change SomeType to an interface and it reproduces the issue I reported above.
interface SomeType {
void wrong(SomeType);
void right(int);
}
I'm on DMD 2.083.0.
|
November 30, 2018 Re: Incorrect ParameterIdentifierTuple results? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Chapman | On Friday, 30 November 2018 at 19:37:52 UTC, John Chapman wrote: > On Friday, 30 November 2018 at 19:07:14 UTC, Neia Neutuladh wrote: >> Compiler and version would be helpful here. >> >> I'm on DMD 2.081.1 and it yields the same results in each case: _param_0 > > Hmm, I was calling ParameterIdentifierTuple inside a lambda - once I moved it into my main function I got the same output as you. > > But … change SomeType to an interface and it reproduces the issue I reported above. > > interface SomeType { > void wrong(SomeType); > void right(int); > } > > I'm on DMD 2.083.0. On Friday, 30 November 2018 at 19:37:52 UTC, John Chapman wrote: This is pretty broken so I've opened a bug: https://issues.dlang.org/show_bug.cgi?id=19456 |
Copyright © 1999-2021 by the D Language Foundation