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

Rescript frustration

$
0
0

I didn’t know about the ? operator in rust, it looks interesting but how do you do when you use it multiple times in the same function with expressions that return different error types?

I’m not a big fan of the use operator from gleam (even though I really like most of gleam’s design decisions), it reverses the flow of operations and makes it harder to scan the logic of a function imo.

I find OCaml’s let* nicer to read but wait until you start using it with complex types, it’s a real mess to understand the error messages. And sometimes it also makes it easier to forget about handling some error cases.

When dealing with such issues, the first thing that comes to my mind is that I don’t bump into this issue that often because you can often just break down the logic into smaller functions that you pipe into each other. And even if you happen to have some ugly and indented code, those escape hatches tend to feel cool at first but it makes it much harder to read your code after some time.

One thing you can do if you want to write code in a more direct way would be to use reanalyze’s exception tracking, it’d be more explicit, easier to read even if you come back to it later imo.

This is a very interesting discussion, so please don’t hesitate to chime in!


Viewing all articles
Browse latest Browse all 1751

Trending Articles