Quoth jand@activestate.com ("Jan Dubois"): > On Wed, 28 Jul 2010, Zefram wrote: > > Jan Dubois wrote: > > >Well, you _could_ add a special case to the string comparison: > > > > That would be a mess. The better solution is for negative zero to > > stringify as "0". But that makes number->string->number round-tripping unreliable, which was the whole reason for stringifying as "-0" in the first place. Lots of code assumes that stringification preserves information. > Indeed. > > <not-really-serious> > Or add a pragma to tree "-0" as false in boolean context: Or simply treat negative zero as true? (Giving us yet another "0 but true" alternative...) Unless I've badly understood something, negative zeros should be rare and only produced by people who are expecting them. Given that the user-visible rule for boolification is 'if it stringifies as "" or "0", it's false; otherwise it's true' (with the numeric checks just being an optimisation) I would probably expect something that stringified as "-0" to be true. BenThread Previous | Thread Next