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

Proposing new syntax for zero-cost unwrapping options/results

$
0
0

I really like this addition! Whatever you decide to name this is great

Just a couple of thoughts.
Using the ? I think makes it confusing from wherever you come.

  • In Javascript is already used for ternaries (also in RS), nullish coalescing and optional chaining (features that could be introduced to ReScript in the future)
  • In Rust the ? is an operator and not part of the let binding
  • In Ocaml we have let*

So why not use let* instead?

But I do think let? is much better than maybe, I’d much rather have a single operator to bind values, instead of 2. It’s easier to add a little decoration to let than to write another word.

Edit:
Something I forgot was that Javascript has yield* (with a *) which EffectTS uses quite a lot for a similar purpose, and someone that might be interested in ReScript is likely also familiar with Effect.


Viewing all articles
Browse latest Browse all 2592

Trending Articles