rescript-lang / rescript-lang/rescript

Clean up/optimize @return(undefined_to_opt) etc.

Open
#7,428 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cleanup
Dominant language
OCaml
Stars
7.5k
Forks
485
Avg merge
1d 2h
Merged PRs (30d)
55

Description

We currently have the following special directives for external function definitions:

@return(nullable)
external someFunc1: unit => option<string> = "someFunc"

@return(null_undefined_to_opt)
external someFunc2: unit => option<string> = "someFunc"

@return(undefined_to_opt)
external someFunc3: unit => option<string> = "someFunc"

@return(null_to_opt)
external someFunc4: unit => option<string> = "someFunc"
  • 1 and 2 are actually the same.
  • For 2, 3, and 4, the naming is unidiomatic (no camelCase, ...).
  • 3 is probably not needed anymore as one could just define the external to return an option?
  • Only 1 is actually documented.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the compiler entry points that handle @return(nullable), @return(null_undefined_to_opt), @return(undefined_to_opt), and @return(null_to_opt), then find the documentation for these directives. Resolve which directives and naming should remain, update the implementation and documentation consistently, and add or adjust coverage for the retained behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.