Skip to content

Syntax: E notation check is missing #6986

Closed

Description

@cometkim
let v = 1e

emits

var v = 1e;

export {
  v ,
}

which is invalid in JS.

Activity

  1. cknitt commented on Sep 5, 2024

    @cknitt
    Member

    Same for

    let v = 1e_

    (or similar with any number of underscores)

  2. cknitt commented on Sep 5, 2024

    @cknitt
    Member

    BTW, also a bit weird (but all valid JS):

    ReScript      JS
    let v = 1     let v = 1;
    let v = 1.    let v = 1;
    let v = 1._   let v = 1.;
    let v = 1.0   let v = 1.0;
    
  3. cometkim commented on Sep 5, 2024

    @cometkim
    MemberAuthor

    BTW, also a bit weird (but all valid JS):

    ReScript      JS
    let v = 1     let v = 1;
    let v = 1.    let v = 1;
    let v = 1._   let v = 1.;
    let v = 1.0   let v = 1.0;
    

    I think the correct resolution is

    let v = 1
    let v = 1.0
    // syntax error
    let v = 1.0
    
  4. cknitt commented on Sep 6, 2024

    @cknitt
    Member

    Agreed!

    Also, at the moment, you can basically do whatever you want underscore-wise, e.g.

    let x = 1_________0_______.____2_____3

    compiles to

    let x = 10.23;

    (FWIW this seems to be the case in OCaml, too.)

  5. cometkim commented on Sep 6, 2024

    @cometkim
    MemberAuthor

    Lol, that's how we supported (superset of?) JS numeric separators

  6. self-assigned this
    on Sep 28, 2024
  7. added theissue type on Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions