Typedef!int + Typedef!int => int? is this a typedef overlook, or it's a feature by design?

mw mingwu at gmail.com
Thu Jun 11 04:59:46 UTC 2020


On Thursday, 11 June 2020 at 04:11:24 UTC, RazvanN wrote:
> I think it is an overlook and therefore a bug. The spec says 
> that the whole point of Typedef is to create a type that is 
> different from the typedefed one (otherwise you would end up 
> with a glorified alias). However the implementation simply

That's my thought too, and on the doc page, the purpose of 
Typedef is:

Typedef allows the creation of a unique type which is based on an 
existing type. Unlike the alias feature, Typedef ensures the two 
types are not considered as equals.

https://dlang.org/library/std/typecons/typedef.html

bug filed:

https://issues.dlang.org/show_bug.cgi?id=20920


> mixins a generic implementation of opBinary that uses the 
> underlying type [1]. The definition of opBinary has no idea 
> that it should wrap the result in another type [2].




More information about the Digitalmars-d mailing list