Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Should ReScript move more towards explicit control flow?

$
0
0

We’ve discussed this at times, but there’s no clear consensus in that pursuing something that enforces that specific style of programming makes sense for ReScript.

However, there are plenty of things we could do to support that use case and make it easier to adopt it fully if you wanted to.

  1. Reanalyze can already do some exception analysis (warn whenever you have code that might throw, that’s not handled properly). This could be extended, polished and made easy to use as 1st class enforcing of “no unhandled exceptions”.
  2. There has been very loose talks about providing something first class that can automatically wrap bindings code into something that catches exceptions and produces a result instead. Pseudo example: @module("some-parser") @toResult external parse: string => result<parseResult, string> = "parse" where parse from some-parser would be a function that can throw.

I doubt we’ll want to be as prescriptive as enforcing one style over the other, and we’ve made a conscious decision in the new stdlib to be close to JS (with some minor deviations). But supporting going that route if you want to is definitely interesting, at least to me.


Viewing all articles
Browse latest Browse all 2592

Trending Articles