digitalmars.D - isSame trait and literals
- Jack Applegame (11/11) Oct 05 2021 ```d
- Basile B. (9/19) Oct 05 2021 Yes, this was discussed two weeks ago and I've filled [this
- Jack Applegame (2/5) Oct 05 2021 Thanks.
```d
enum isSame1(alias a, alias b) = __traits(isSame, a, b);
enum isSame2(args...) = __traits(isSame, args[0],
args[1]);
pragma(msg, isSame1!(1, 1)); //false
pragma(msg, isSame2!(1, 1)); //true
pragma(msg, isSame1!("test", "test")); //false
pragma(msg, isSame2!("test", "test")); //true
```
Looks like a bug.
try yourself: https://run.dlang.io/is/Edlz28
Oct 05 2021
On Tuesday, 5 October 2021 at 19:28:30 UTC, Jack Applegame wrote:
```d
enum isSame1(alias a, alias b) = __traits(isSame, a, b);
enum isSame2(args...) = __traits(isSame, args[0],
args[1]);
pragma(msg, isSame1!(1, 1)); //false
pragma(msg, isSame2!(1, 1)); //true
pragma(msg, isSame1!("test", "test")); //false
pragma(msg, isSame2!("test", "test")); //true
```
Looks like a bug.
Yes, this was discussed two weeks ago and I've filled [this
issue](https://issues.dlang.org/show_bug.cgi?id=22269) in
consequence.
At first glance that would be a problem with
AliasTemplateParameter.
Phobos `isSame` could be updated to use a
TemplateVariadicParameter so that the body could just the __trait
result.
Oct 05 2021
On Tuesday, 5 October 2021 at 19:38:15 UTC, Basile B. wrote:Yes, this was discussed two weeks ago and I've filled [this issue](https://issues.dlang.org/show_bug.cgi?id=22269) in consequence.Thanks.
Oct 05 2021








Jack Applegame <japplegame gmail.com>