DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

Isaac S. spam-no-reply-isaac at outlook.com
Wed Nov 14 04:33:23 UTC 2018


On Wednesday, 14 November 2018 at 04:27:05 UTC, Walter Bright 
wrote:
> There have been various attempts over the years to "fix" 
> various things in the D matching system by adding "just one 
> more" match level. I've rejected all of them, because things 
> that look simple and obvious with trivial examples tend to sink 
> in a swamp with the dirty reality of the rather vast number of 
> types and conversions that D supports. This happens in C++, and 
> what people tend to do is just throw up their hands and 
> hackishly add in more overloads until they get the result they 
> want.

The thing is, this isn't a new match level. Rather than the enum 
implicitly casting to its literal (I'm hoping I'm using the 
correct word here) I'm proposing it implicitly cast to its typed 
literal (Instead of A.a implicitly converting to 0, it converts 
to int(0)). This would mean it would match the int since its a 
direct match.


More information about the Digitalmars-d-announce mailing list