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

Should ReScript move more towards explicit control flow?

$
0
0

1 and 2 are different problems although there’s some overlap in general.

1 is about rescript code, 2 is about externals. there’s no clear “safe” way to do externals right now (think try in moonbit or zig). there’s not even any way to clearly know whether an external throws, jsland is so content with exceptions being thrown that they’re sometimes not even documented. but i’d be in favor of something like

let Ok(foo) = try? bar() which turns foo into a Result<'a, Exn.t> or similar. togeher with it, i’d also like

let foo = try? bar() else { "abc" } where foo can only ever be of type 'a. i’m probably missing a few cases here and it would probably also tie into early returns somehow, and it could probably be done with a modified let? and so on. but this needs to be explored more in rescript.


Viewing all articles
Browse latest Browse all 2592

Trending Articles