Phobos 3 Discussion Notes - 02-01-2024

Paul Backus snarwin at gmail.com
Sun Feb 4 15:04:00 UTC 2024


On Sunday, 4 February 2024 at 09:30:58 UTC, Jonathan M Davis 
wrote:
> The main thing that it needs IMHO is going through it and 
> making sure that it's doing the right thing for each trait and 
> that the exact set of traits that it has is really what we 
> want, since right now, several of them are doing the wrong 
> thing (e.g. treating enum as if it were its base type with 
> stuff like isIntegral, isNumeric, etc., which is a source of 
> bugs).

I have bad news for you. This behavior is not the fault of 
std.traits, but is actually baked into the language itself. For 
example, the spec for __traits(isIntegral) says:

> The integral types are: byte, ubyte, short, ushort, int, uint, 
> long, ulong, cent, ucent, bool, char, wchar, dchar, vectors of 
> integral types, and enums with an integral base type.

https://dlang.org/spec/traits.html#isIntegral

Maybe we can clean this up in a new language edition, but as long 
as this is how the underlying __traits work, std.traits should 
work the same way.


More information about the Digitalmars-d mailing list