On Sun, Feb 22, 2009 at 9:30 AM, Allen Wirfs-Brock
<[email protected]> wrote:
> David-Sarah Hopwood wrote:
>>
>>Herman Venter wrote:


> Finally, there is another approach to resolving this issue.  Define a new 
> global function, parseInteger, that does the "right thing" and relegate 
> parseInt to Annex B.
>

That is a good idea, but I wonder: Would programs use that?

a program could use:

  i = parseInt(x)

- which can result in undesirable behavior. That is fixed by:-

  i = parseInt(x, 10)

- or the proposal:-

  if(typeof parseInteger == "function") {
    i = parseInteger(x);
  } else {
    i = parseInt(x, 10);
  }

-which seems a bit clunky. How about just:-

  i = parseInteger(x)

but that last one may result in an error, should the implementation
not support the new function. Programs that use parseInt(x, 10) will
work in more implementations.

Garrett
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to