error-type equality, intended ?

Paul Backus snarwin at gmail.com
Tue Mar 3 14:46:56 UTC 2026


On Tuesday, 3 March 2026 at 14:34:56 UTC, user1234 wrote:
> I wonder if the following static assertion is intended, i.e 
> "our type system plans this" or if it's an implemenation detail 
> (i.e "we dont thought to that case but it turns out this is 
> like that")
>
> ```d
> enum e1 = is(typeof(ERROR) == typeof(ERROR));
> static assert(!e1); // passes
> ```
>
> what do you think  ?

I think it's probably accidental that `is(T == U)` short-circuits 
to `is(T)` if `T` does not exist. If I were to design a "version 
3.0" of the D language, starting from scratch, I would not 
include this behavior.

Unfortunately, it has been around for such a long time, and is 
depended on by so much existing code, that changing it is not 
realistically possible, even with editions.


More information about the Digitalmars-d-learn mailing list