Replies: 1 comment
-
Here's a pretty ugly workaround: let x = () => {
if let x = foo() { return x; }
throw "bad foo!";
}();
let y = () => {
if let x = bar() { return x; }
throw "bad bar!";
}();
let z = () => {
if let x = geez() { return x; }
throw "bad geez!";
}(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Once upon a time, a friend told be about the never nesters, and I immediately knew I found my people.
Wing has this really awesome feature called
if let
which allows me to write nil-safe code:This is all great, but the problem is that oftentimes,
nil
represents the "unhappy path" and us, never nesters, prefer to bail out early from unhappy paths, so we can continue to never nest our way through the happy path.This cases my happy path look like this, and my never nesting values to be flushed down the toilet:
Can we make a never nester happy and offer a negative
if let
? Maybe something like this:Beta Was this translation helpful? Give feedback.
All reactions