reasonml / reasonml/reason

Print ternary as if-else

Open
#1,700 14 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We can still accept ternaries but print them as if-else.

  • Getting folks used to the fact that if-else in ocaml/reason is an expression is good. This also makes people realize they don't have to overdo ternary in jsx expressions
  • Ternaries are more useful and sugary in JS where there's no clean pattern matching syntax
  • Fewer things to learn for newcomers. Still caters to JS users with a penchant for ternary

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 locating the parser and printer entry points for ternary expressions, then inspect existing syntax regression tests and the issue discussion. Done means ternaries remain accepted as input but are consistently printed as if-else expressions, with tests covering the resulting output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ocaml
Domain
compilers
Issue type
Feature
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.