[phobos] Fw: cast(bool) vs. opUnary!"!"
Andrei Alexandrescu
andrei at erdani.com
Tue Mar 9 07:19:52 PST 2010
Walter and I agreed that cast to bool is as good as opUnary. Overloading
unary "!" is now not possible.
Andrei
Steve Schveighoffer wrote:
> D'oh!
>
> Sorry, this went to the old list.
>
> -Steve
>
>
>
> ----- Forwarded Message ----
>> From: Steve Schveighoffer <schveiguy at yahoo.com>
>> To: Phobos <phobos at erdani.com>
>> Sent: Tue, March 9, 2010 9:30:16 AM
>> Subject: cast(bool) vs. opUnary!"!"
>>
>> In the latest dmd 2.041, cast!T was added, and if statements were changed to do:
>>
>> if(s) => if(cast!bool(s))
>>
>> What happened to if translating to:
>>
>> if(!!s)
>>
>> which translates to ! opUnary!("!). Hm... that's a lot of !'s :)
>>
>> I thought that was the plan, at least it was in the book. Is that going away?
>>
>> It does make more sense to use cast(bool) because opUnary!"!" could potentially
>> return a non-bool value.
>>
>> -Steve
>
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list