rescript-lang / rescript-lang/rescript
Better callable subtyping for optional parameters
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 7.5k
- Forks
- 485
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 55
Description
If a function has N required params & additional optional params, it cannot be used in a place that expects a function with N params.
To give a concrete example: Int.toString cannot be directly used with Option.map because of the optional radix argument, so it has to be wrapped in another function.
Tested in sandbox v12.1
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.
Research direction
Start with the linked ReScript sandbox and reproduce the Int.toString and Option.map example in version v12.1. Investigate the compiler's callable-subtyping behavior for required and optional parameters. Done means Int.toString can be passed directly to Option.map without a wrapper while existing required-parameter behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100