I can’t find a docs page in the language manual or Core docs which lists stuff that is automatically included? What I’m thinking of is an authoritative page that says option
and result
are automatically available without a module reference or open
call (in other languages I have seen this referred to as the built-ins or prelude).
Does such a page exist and I’m not not finding it?
These are found under the Language Features section of the docs.
It’s missing anything explicitly about the result
type, but it does have a page about Option. I’d be down to work on improving this area of the docs. Do you have any examples from other languages that show the type of info you are looking for?
The tricky bit is most languages I’m familiar with have specific modules from their standard library that get automatically pulled in, and so they just document what those modules are. For Python its builtins — Built-in objects — Python 3.12.3 documentation and for Rust its std - Rust and specifically the std::*
section (new users are capped at 2 URLs, so I didn’t keep looking for more examples). ReScript doesn’t seem to have an equivalent “we call open
automatically on this module from Core”, instead having specific things like option
and result
.
If result
is the only thing missing, then maybe just expand “Null, Undefined and Option” to include it? Otherwise it’s like there’s a need for “Other Types” or “Non-Primitive Types” page.
1 Like