sway icon indicating copy to clipboard operation
sway copied to clipboard

Structual records?

Open Centril opened this issue 3 years ago • 0 comments

The idea here is that we would add structural records to the language.

I proposed this initially as an addition to Rust (see https://github.com/rust-lang/rfcs/pull/2584), but it was never added, mainly due to a large backlog of other features to implement.

The proposed syntax is exactly as that in Rust, in expression, pattern, and type contexts alike. So for example, you could write { foo: 42, bar: true, baz: "abcd" }, and this would be typed as { foo: u64, bar: bool, baz: str[4] }. Note that structural records would be added alongside structs, as a convenience, but not to replace them.

Centril avatar Sep 07 '22 20:09 Centril