5 ms·
Here's Rust's try (?) operator.[1] It seems sugar for handling short-circuiting return values. A bit like Swift's try? which converts throws to nil.[2] Less so
by mncharity 4y ago
Here's Rust's try (?) operator.[1] It seems sugar for handling short-circuiting return values.
A bit like Swift's try? which converts throws to nil.[2] Less so javascript's short-circuiting optional chainging `?.`[3], which I thought of first.
[1] https://doc.rust-lang.org/std/ops/trait.Try.html https://doc.rust-lang.org/std/ops/trait.Try.html
[2] https://docs.swift.org/swift-book/ReferenceManual/Expressions.html https://docs.swift.org/swift-book/ReferenceManual/Expression... then /Try Operator/ - section anchors don't look stable.
[3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...