asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 148 forks source link

Define “source” #53

Closed mathiasbynens closed 10 years ago

mathiasbynens commented 11 years ago

a numeric literal with the character . in its source

The spec mentions the source of numeric literals in various places.

However, the spec does not unambiguously define what this means exactly (at least not AFAICT). Consider 1e-5, for example — is there a . character in its source? What about 0.00001?

IMHO, the source concept should be defined to avoid this ambiguity.

The intended definition is probably something among the lines of:

Whenever this document refers to the source of a numeric literal, it means the return value of calling the abstract operation ToString() as defined in the ECMAScript 5.1 specification on the numeric literal.

cscott commented 11 years ago

I believe the text means, "in the source text of the program". 1e-5 is a bug in the spec. But the intention seems to be to distinguish between (say) 0 and 0.0 -- which would both have the same "return value of calling the abstract operation ToString()".

ghost commented 10 years ago

Yes, "source" means "source text", as in "the source text that is fed into the parser defined by the ES5 spec".