samuelgoto / proposal-number-parse

3 stars 0 forks source link

Polyfill? #1

Open samuelgoto opened 7 years ago

samuelgoto commented 7 years ago

@ljharb can you help me articulate here why polyfilling this in isn't a better idea (as opposed to baking it into the language)?

ljharb commented 7 years ago

It needs to stay in sync with Number, so any polyfill would have to feature-detect what Number supported, and thus only polyfill those capabilities.

(Obviously a polyfill for this proposal would have to do that regardless, but that's a lot of burden to impose on users forever imo)

fuchsia commented 7 years ago

@samuelgoto I've create an extractLiteral repo which contains the source of my prototype.

I've implemented it modern JS with regex. I do have a char-by-char parser, but it's hard to justify the extra complexity.