[phobos] Fw: cast(bool) vs. opUnary!"!"
Steve Schveighoffer
schveiguy at yahoo.com
Tue Mar 9 06:34:11 PST 2010
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
More information about the phobos
mailing list