hd-lang

Tour · 10 of 25

A record says which fields are required, and ... copies one with changes

A struct type lists its fields. A field with a default may be left out, and a field without one must be given, so a config can't be built half-filled. A struct is a value, so to make a variant, ... copies every field of an existing value and you name only what changes; the original stays as it was. No builder class, no setter that edits a config other code is already using.

Run: Ctrl+Enter · Pages: Alt+← Alt+→