reasonml / reasonml/reason

Unify name mangling rules

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

Nobody has claimed this yet.

Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Since BuckleScript is going to release a v8 and maybe Reason a v4, I think now could be a good time to fix name mangling issues once for all and stick to one rule.

Right now we have this Reason code:

let foo = {"_to": 10, "_type": 1};
type bar = {
  _to: int,
  _type: string,
};
let bar = {_to: 10, _type: "bar"};
ReactDOMRe.renderToElementWithId(<input type_="text" />, "preview");

compiling to:

var foo = {
  to: 10,
  type: 1
};
var bar = {
  _to: 10,
  _type: "bar"
};
ReactDOMRe.renderToElementWithId(React.createElement("input", {
          type: "text"
        }), "preview");

which is definitely not coherent.

I'd be in favor of using trailing underscores since leading underscores is already used to name unused variables but I'd be happy with any coherent rule.

Contributor guide

No contributing guide indexed for this repository

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 comparing the Reason examples in the issue with their generated JavaScript, focusing on object keys, record fields, and JSX attributes. The issue does not specify a final naming rule, so completion depends on agreeing on one coherent rule and applying it consistently across these cases.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.