yank unary '+'?

Michel Fortin michel.fortin at michelf.com
Mon Dec 7 20:01:03 PST 2009


On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Using double negation !!x throughout, there are only advantages and no 
> disadvantage. I hit that design with Pacquiao punches over the past 
> week or so, and couldn't find any shortcoming. It's consistent across 
> positive and negated uses, easy to understand, easy to define, 
> consistent with built-in types, and Walter likes it.

I'm not sure that's a great idea. What if you define your own FuzzyBool 
type (containing some sort of probability) and FuzzyBool.opUnary!("!") 
returns an inverted FuzzyBool (with 1 - original probability) instead 
of a regular bool, you'd have an infinite loop trying to evaluate 
!!myBoolValue.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list