why (null <= 0) is true?

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Sep 25 03:41:36 PDT 2012


OT: Really David ... you use a french keyboard too? I can't imagine me
programming with an italian layout :D

I believe the question was about fixing or spec'ing the behavior which
seems reasonable.

We already decided to break the web with all new syntax stuff and "use
strict" directive so if ES7 will have null <= 0 false I don't see how this
could break the web ... I mean, typeof is already broken in ES3 compared to
ES5 and use strict, the fact that specs say that null == null and undefined
and nothing else means that developers would expect that <= or >=  whatever
that is not null or undefined to be false.

my 2 cents

On Tue, Sep 25, 2012 at 11:22 AM, David Bruant <bruant.d at gmail.com> wrote:

> Le 25/09/2012 12:13, Frank Quan a écrit :
> > Hi, Brendan, thank you for reply.
> >
> >
> > I mean in common understanding, "a>=b" always have the same result
> > with " a>b || a==b ".
> Common understanding assumes a and b are numbers. I personally don't
> know if there is a common understanding of what 'true > "azerty"' could
> mean.
>
> > But I noticed that in ES5/ES3, there are several cases breaking this
> rule.
> >
> > See the following:
> >
> > null == 0 // false
> > null > 0 // false
> >
> > null >= 0 // true
> >
> > I was wondering if this is by design.
> >
> > And, is it possible to have some change in future versions of ES?
> Regrettably, no. As a complement to Brendan's response, I recommand you
> to read the following paragraph
>
> https://github.com/DavidBruant/ECMAScript-regrets#web-technologies-are-ugly-and-there-is-no-way-back
> Changing this in a future version of ECMAScript would "break the web"
> (break websites that rely on this broken behavior)
>
> David
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120925/cb2cd992/attachment.html>


More information about the es-discuss mailing list