September 16, 2018
On Sunday, 16 September 2018 at 01:29:38 UTC, Mike Franklin wrote:
> On Saturday, 15 September 2018 at 20:07:06 UTC, Steven Schveighoffer wrote:
>
>> Looks pretty good to me. The only question I have is on this part:
>>
>> enum YesNo : bool { no, yes } // Existing implementation: OK
>>                               // After stage 1: Deprecation warning
>>                               // After stage 2: Error
>>                               // Remedy: `enum YesNo : bool { no = false, yes = true }`
>>
>> Why is this necessary? I can't see how there are integer literals being used here, or how implicitly going from `false` to `true` in the 2 items being enumerated is going to be confusing.
>
> You're right, I just tested the implementation, and this is not necessary.  I'll remove it.  Thanks!
>
> Mike

What about:

enum E: bool {
    no, yes
}

void main() {
    E e = cast(E)(0);
}

Would be illegal I assume?

And I think the confusing part about "enum E: bool { yes, no }" is that most people did not catch the bug in the code I just wrote in this sentence.

Cheers,
- Ali
September 17, 2018
On Sunday, 16 September 2018 at 23:59:18 UTC, aliak wrote:
> What about:
>
> enum E: bool {
>     no, yes
> }
>
> void main() {
>     E e = cast(E)(0);
> }
>
> Would be illegal I assume?

You have an explicit cast, so no, it would be fine.



1 2
Next ›   Last »