Is there a list of reserved words for Reason? (aka reserved keywords, identifiers)


#1

Is there a list of reserved words for Reason?


Context:

I just tried to make a record type like so:

type todo = {done: bool, description:string};

That doesn’t work because done is apparently a reserved word. Knowing what reserved words are I tried searching for a list of those words. Similar to this for JavaScript.

I could not find one. Or perhaps I’m using the wrong search terms.

I did find this page with lexical grammar for OCaml. And we probably cannot use any of those in Reason code (right?).

For Reason I did find these two API reference pages:

But they don’t say anything about the done keyword.

So my question remains.

If there’s no such list: shall I have a go at making one?


#2

Reason has introduced a few new keywords (switch instead of match for example) but most OCaml keywords should be Reason keywords as well. They’re listed here: http://caml.inria.fr/pub/docs/manual-ocaml-312/manual044.html


#3

It would be really useful if in addition to having all the reserved words documented, we also had really nice errors for them with the -bs-super-errors flag. Currently that one is just plain "Error: 506: ", which isn’t very helpful. One that’s bit me before is end in type dur = {start: string, end: string};.

See also https://github.com/reasonml-community/error-message-improvement/issues/68.


#4

Has there been any progress in a full list of reserved keywords for Reason and not just OCaml?


#5

We are currently in the process on gathering missing information for the documentation. A list of reserved keywords for Reason is definitely very high on our list!


#6

For those interested, I opened an issue to keep track of this: https://github.com/reason-association/reasonml.org/issues/13

Feel free to add more feedback on what is missing / is unclear in the current documentation. The more input we have, the better!