Why was the fun keyword removed from rescript?

Ocaml and reasonml and f# both have it. I can see some developers like myself being a bit annoyed with the removal (but really pleased with the IDE tooling, great work!).
Was it removed to make rescript codebases more readable to javascript developers?

1 Like

Looks like you answered yourself :wink:

see this

1 Like

I see. I can live without it, but it would be a nice addition, specially with piped expressions.

2 Likes

There were multiple reasons to not support the fun keyword:

  • No confusion for JS developers
  • Less concepts to learn, less ways to achieve the same thing
  • We spare us a keyword, which gives us more wiggle room with the grammar and its future evolution
  • Less surprises due to extra function allocations in the emitted JS code
  • Less parser code to maintain → less potential bugs or confusing error messages etc.

The most weight for this decision was on the complexity / maintainability side though.

1 Like

The “pipeable” switch proposal doesn’t require an extra keyword :slight_smile: No idea about parser complexity though.

3 Likes