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

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Nov 14 07:03:49 UTC 2018


On Wednesday, 14 November 2018 at 06:56:12 UTC, aliak wrote:
> On Tuesday, 13 November 2018 at 09:17:51 UTC, Walter Bright 
> wrote:
>> [...]
>
> Ok, thanks!
>> [...]
>
> Bummer. At least if this enum : int case is fixed that doesn't 
> seem like it's hard to work out in my head at least - but I 
> guess I'm missing some edge case maybe, but I can't figure it 
> out.
>
> Pus, it seems to work as "expected" with alias this. So I kinda 
> wonder what reasons there could be to not make it work as 
> expected for other scenarios.
>
> struct B {
>     enum A : int { a }
>     alias b = A.a;
>     alias b this;
> }
>
> void f(short) {}
> void f(int) {}
>
> f(B()); // does what anyone would expect

Hahaha! That is hilarious! for the curious 
https://run.dlang.io/is/fqlllS


More information about the Digitalmars-d-announce mailing list