Could a “safe” version of the standard lib ever ex...
# stdlib
d
Could a “safe” version of the standard lib ever exist? Which could be used to replace with the normal standard lib, but without the functions that throw runtime exceptions, and instead returned nullable types or Either style sum types? Alternatively the unsafe functions could somehow fail the build if you use them. Kind of like how you can use Prelude replacements in Haskell.
s
Cant see why not. Split the std in safe and unsafe. In practice it doesnt seem like a focus for JB since not all methods have a safe variant and the throwing version got the shorter name. (they chose `opx : R`/`opxOrNull : R?` instead of `opx : R?`/`opxOrThrow : R`.. I would have preferred the alternative)
d
yeah I had noticed that, my experience has been that it’s hard to police, and I’ve often not realised something throws a runtime exception until it’s too late!
I think you’re right about it not being a prime concern for JB as it would impact usability/readability/verbosity