On Wednesday, 1 September 2021 at 23:04:18 UTC, Per Nordlöw wrote:
On Wednesday, 1 September 2021 at 22:51:40 UTC, Per Nordlöw
wrote:
Can somebody explain the need for
Ok, `__traits(isSame)` always returns false for values.
This is very unfortunate as `std.traits.isSame` is one of the
most used template instances in typical std.meta-programming
and has a noticeable impact on time and space complexity now
that AliasAssign-enabled versions of std.meta members have
removed the need for other costly recursive template patterns.
I suggest we add a new builtin trait that exactly mimics
std.traits.isSame or inline the calls to `isSame` in
`std.traits.meta`. This is gonna significantly speed up
functions in std.meta, for instance `staticIndexOf`,
`EraseAll`, `GenericReplace`, `ReplaceAll`, `Pack`.
I suggest to change the template signature instead:
```d
template isSame(Args...)
if (Args.length == 2)
{
enum isSame = __traits(isSame, Args[0], Args[1]);
}
```
The problem is not `__traits(isSame)`, it's more the
TemplateAliasParameter, as observed previously.