Support for something like Rust if-let #22285
tknawara
started this conversation in
General Discussion
Replies: 1 comment
-
This reminds me dart-lang/language#4205 |
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
-
Hi team,
I'm very new here, so apologies if I didn't provide enough details. I'm wondering if you have given any thoughts around supporting something like rust if let
The basic idea is to allow for destructuring in if condition and bind everything in the if scope, you can already do that with
match
of course, but I often find myself only interested in a single case of an enum for example while the remaining cases won't need special handling for them.This is already supported in different scala constructs like for comprehensions and would be nice to do something like
instead of
It gets complicated if you want to use v further in the condition though
Beta Was this translation helpful? Give feedback.
All reactions