You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message SomeMsg {
iField: Int;
sField: String;
}
receive(msg: SomeMsg) {
let first: Int = msg.iField;
let second: Int = msg.sField;
}
we could have the following:
message SomeMsg {
iField: Int;
sField: String;
}
receive(msg: SomeMsg) {
let { first, second } = msg; // when we'll have a local type inference from #161
// and
let { onlyFirst, _ } = msg; // discarding the unwanted fields
// Trailing commas should be allowed as well:
let { firstAgain, secondAgain, } = msg;
// The inverse of such destructuring operation is already present in the language:
SomeMsg{ iField: first, sField: second };
}
Note, that this won't require any advanced pattern matching capabilities and should be rather simple to implement in the compiler. Marked this as a discussion because this is just a suggestion. This may or may not drive further improvements of working with Structs and Messages to make it much more convenient.
Instead of:
we could have the following:
Note, that this won't require any advanced pattern matching capabilities and should be rather simple to implement in the compiler. Marked this as a discussion because this is just a suggestion. This may or may not drive further improvements of working with Structs and Messages to make it much more convenient.
Depends on #161.
The text was updated successfully, but these errors were encountered: