-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Labels
requestRequests to resolve a particular developer problemRequests to resolve a particular developer problem
Description
Today we have patterns that allow us to deconstruct a variable:
class Class {
int myField = 0;
}
void foo() {
var instance = Class();
if (instance case Class(myField: var myFieldValue)) {}
}
This only creates new variables after the :
. I'd like to request a way for us to assign this to an existing variable. This could only work when we have this outside if
/for
lines, like:
late int myValue1;
late int myValue2;
late int myValue3;
if (test) {
Class(myField := myValue1, otherField := myValue2, thirdField := myValue3) = instance;
} else {
myValue1 = 0;
myValue2 = 0;
myValue3 = 0;
}
The :=
is only a representation here, I'm not certain this is the best solution. This would allow us to avoid creating multiple lines here.
Metadata
Metadata
Assignees
Labels
requestRequests to resolve a particular developer problemRequests to resolve a particular developer problem