Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax: E notation check is missing #6986

Closed
Tracked by #6995
cometkim opened this issue Aug 28, 2024 · 5 comments · Fixed by #7174
Closed
Tracked by #6995

Syntax: E notation check is missing #6986

cometkim opened this issue Aug 28, 2024 · 5 comments · Fixed by #7174
Assignees

Comments

@cometkim
Copy link
Member

let v = 1e

emits

var v = 1e;

export {
  v ,
}

which is invalid in JS.

@cknitt
Copy link
Member

cknitt commented Sep 5, 2024

Same for

let v = 1e_

(or similar with any number of underscores)

@cknitt
Copy link
Member

cknitt commented Sep 5, 2024

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;

@cometkim
Copy link
Member Author

cometkim commented Sep 5, 2024

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

@cknitt
Copy link
Member

cknitt commented Sep 6, 2024

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.)

@cometkim
Copy link
Member Author

cometkim commented Sep 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants