why (null <= 0) is true?
bruant.d at gmail.com
Tue Sep 25 05:44:55 PDT 2012
Le 25/09/2012 12:41, Andrea Giammarchi a écrit :
> OT: Really David ... you use a french keyboard too?
> I can't imagine me programming with an italian layout :D
I think it's just a matter of habit. Regardless, I use WebStorm as text
editor, I think most of my code is written thanks to autocompletion
rather than by typing letters :-)
Also since source code is a tree and not a string, I'm looking forward
to the day tools like Waterbear  will become mainstream and keyboard
will just be used to name variables/functions, choose constants and hint
the autocomplete engine.
> 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
This is not true. In theory, before ES5, maybe some people had the "use
strict" string in some js files. But let's be honest, no one actually
did. No one reported that their program broke because of the addition of
strict mode. As I say in ECMAScript Regrets, changing the current
semantics is not possible, however, it's still possible to improve the
language by adding new construct like pragma directives or new syntax.
In theory again, it could break programs, but that would be programs
which relied on syntax errors to work properly. I would say it's
reasonable to break such programs.
> so if ES7 will have null <= 0 false I don't see how this could break
> the web ...
Maybe some webpages depend on null <= 0 to be true.
It relatively easy to have a JSON array which you loop over and which
elements are numbers or null and rely on null <= 0 to be true to work
properly. We've seen more crazy assumptions.
More information about the es-discuss