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 <[email protected]>
To: Phobos <[email protected]>
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
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to