5 ms·
What was worse about Rust 1.0's error handling that, say, Typescript's Result? They look very similar to me. What do you mean by "a lot of churn"? The only sig
by roca 7y ago
What was worse about Rust 1.0's error handling that, say, Typescript's Result? They look very similar to me.
What do you mean by "a lot of churn"? The only significant thing I can think of is that the try! macro turned into the ? operator.
- lmm 7y agoComposing first-class functions is much more idiomatic in typescript, because there's only one function type, so you can do the railway-oriented programming style. In a sense Rust doesn't quite have first-class functions yet (and I'd argue that NLL actually made functions less first-class than they were before): you can't always pull out a given block of code into a closure, because the resulting code may not pass the borrow checker. Whereas in Typescript (() => x)(), (a => x)(a) etc. are always equivalent to x.
- roca 7y agoThat's true but that seems to be an inevitable consequence of the Rust ownership model. Which means this is just another example of where the "one big innovation" in Rust just isn't orthogonal to other language design issues, as you suggested it should be.
- lmm 7y agoTo a certain extent yes, but it's a problem that they've made much harder for themselves by trying to support both OCaml-style first-class functions and C/Java-style imperative control flow. If the NLL work around control-flow keywords had gone into first-class functions, I suspect we'd see a good solution by now; conversely if they'd committed to C++/Java style with what works there (i.e. exceptions) that would also probably make for a result that was easier to use.