reasonml / reasonml/reason

`bs` and `bs.obj` ppx apply deeply

Open
#2,584 1 comment 0 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

When using [@bs] to uncurry a function it is applied deeply. Probably it's better to apply it only on the most shallow level:

[@bs] uncurriedFun({
  normalFun(1)
});

In this case the output of the ppx is that normalFun is also called uncurried.

A similar thing happens with [@bs.obj]. All fields (even if it's part of the field expression) are converted to objects.

example:

[%bs.obj]
{
  test: {actually_a_record: 1}
}

cc @jfrolich
moved from https://github.com/BuckleScript/bucklescript/issues/4306

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

No source file or test is named. Reproduce the two examples and inspect the PPX expansion for bs and bs.obj. Done means the outermost application or object expression is converted without converting nested normalFun calls or record fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ocaml
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.