4 ms·
If you're using a record, you're effectively just using a struct again...
by douche 10y ago
If you're using a record, you're effectively just using a struct again...
- haasn 10y agoMathematically, structs and tuples are virtually equivalent. They are both examples of the same fundamental data construct: Product types (i.e. grouping multiple values together) The other two most important abstractions are sum types, i.e. unions or alternatives, and exponent types, i.e. function types, and IMO they're the two that are far more important for the success of functional programming.
- bunderbunder 10y agoI think that one depends on the language. In F#, for example, records are pass-by-reference and structs are pass-by-value. In a language-unspecified setting I like to follow the convention that structs are implied to be mutable data types and records are implied to be immutable data types. I don't know how widely-used that convention is, though.