This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Differentiate between fn(.) and fn(.()) #138
Closed
Description
Extracted from this issue:
Currently they are all de-sugared into OCaml syntax fn () [@bs]
The thing is that in BuckleScript, since there is no syntax space for arity zero, so we make a special form that fn () [@bs] is treated arity zero application.
I wonder Reason could make a difference here which feels more intuitive:
fn (.) --> arity zero -> fn () [@bs]
fn (. ()) --> arity 1 -> let unit = () in fn unit of course, some care need to be taken to avoid name collision
Example where this causes an issue:
Js.Promise.make((~resolve, ~reject as _) => Js.Global.setTimeout(() => {
resolve(. ())
}, 1500)->ignore)
Metadata
Metadata
Assignees
Labels
No labels