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

Gleams use expression

$
0
0

The Gleam hype started and I was curious about some language goodies.
While reading the language tour (a lot of similar stuff to Rescript), I stopped at the use expression.

Use what? The use expression is just some syntactic sugar for (nested) callbacks.

There are already many discussions (some are a bit older) and I don’t want to bother anyone, but well …

  1. F# with computation expressions (I hate to implement them, but I like to use them)
  2. Scala with for comprehensions
  3. Haskell with monad comprehensions
  4. OCaml with let op

And now Gleam with use.

All of these languages offer some kind of syntactic sugar for combining multiple results, options, etc.
Some are builtin, some have to be implemented by yourself and can be extended immeasurably.

I think overriding the let binding (OCaml version) or implementing custom computation expressions (F#) could “destory” the simplicity of Rescript and could confuse other devs while reading your code, but the use expression looks like a simple and generic way to hide callback hells.

What do you think?


Viewing all articles
Browse latest Browse all 2592

Trending Articles