jashkenas / jashkenas/coffeescript

Allow implicit calls with inline for/while?

Open
#5,196 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Noticed this while working on the Prettier plugin: there's currently an asymmetry between inline `if` vs inline `for`/`while` with respect to implicit calls

Eg this parses:
```
a if b then c
a b, if c then d
```
While these don't:
```
a while b then c
a b, while c then d

a for b in c then d
a b, for c in d then e
```

I started playing with this on my `allow-implicit-call-for-while` branch but was running into some tricky stuff in the rewriter

So opening this issue at least as a reminder

Not sure if there's ever been any consideration/discussion of this?

Contributor guide

Open the contributing guide

Research direction

Start by comparing how inline `if` supports implicit calls with the corresponding inline `for` and `while` cases. Investigate the rewriter, where the issue reports tricky behavior, and verify the examples for calls before and after the inline clauses. Done means both `for` and `while` forms parse consistently with inline `if` without breaking existing cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
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.