rescript-lang / rescript-lang/rescript

Proposal: Optional "return" as Syntactic Sugar in ReScript 13

Aperta
#8,191 7 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
OCaml
Stelle
7.5k
Fork
485
Merge medio
1g 2h
PR unite (30g)
55

Descrizione

Author: Jonathan Jewell Status: Draft / RFC Goal: Facilitate onboarding for JS/TS developers without compromising ReScript’s functional core.


Overview

Add return as optional syntactic sugar for function expressions. This desugars to the last expression during compilation, with zero semantic or performance impact.

Current ReScript | Proposed (Sugar) | Desugared Output -- | -- | -- let add = (a, b) => a + b | let add = (a, b) => return a + b | let add = (a, b) => a + b

Call to Action

  • If this sounds good, I am offering to:
    • Implement the prototype and draft documentation.
    • Monitor community feedback and report back before ReScript 14.
  • Proposal team:
    • Greenlight: To try it as an experiment, see what the reception is.
    • Feedback: Suggest improvements or dealbreakers.
    • Veto: If the team feels this is misaligned, we can drop it - no hard feelings!

Final Note:

This is not about changing ReScript, but I think it is useful in helping onboard more developers to discover why it is great and helps users implement some of the most basic functions in their language in Rescript. If it does not work or is received poorly, we can kill it without any issue. But in any case, it is optional for use, and - as sugar - and would not anticipate any reason to affect backward compat or future ambitions for the language.


Next Steps:

  1. Discuss in the next core team meeting.
  2. If approved, I’ll open a PR for the prototype.
  3. Interact with the community via an RFC or blog post.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

La issue non indica file, test o punti di ingresso del compilatore. Inizia dalla discussione sull’RFC e dalla revisione pianificata da parte del core team; per considerarla completata sarebbero necessari un prototipo approvato e una bozza della documentazione, seguiti dal feedback della community.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, ocaml
Ambito
compilers, developer-experience
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.