rescript-lang / rescript-lang/rescript
Dict : Accessing items with bracket, like an array or object
Open
@zth is already working on this.
Since Apr 19, 2026.
- Dominant language
- OCaml
- Stars
- 7.5k
- Forks
- 485
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 55
Description
For adict{}, we can access a value only by using Dict.get
let d = dict{"A": 5, "B": 6, "C": 7}
let a = d->Dict.get("A")
The goal is to also using a bracket syntax, like with arrays or objects (without removing Dict.get, just like Array.get and Object.get still exist)
let d = dict{"A": 5, "B": 6, "C": 7}
let a = d["A"]
This would allow some bindings to use dict{} instead of {..} while keeping the same ease of access to values.
The next step could be variable keys but I created this feature request to propose a smaller step that can already be really useful, without having to wait for variable keys.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.