4 ms·
Because most devs don't think from type theory principles. They see the keyword "struct" and associate it to C# struct which is stack allocated. Then they see
by fjuwnsd 2y ago
Because most devs don't think from type theory principles.
They see the keyword "struct" and associate it to C# struct which is stack allocated.
Then they see the keyword "record" and think Java record which is syntax sugar for class which is heap allocated.
They never draw the connection that they are both ways to express product types.
- ndriscoll 2y agoWhether something is boxed or not is relevant in practice for performance. It's reasonable to have a jargon where products, records, and structs are distinct concepts.
- taeric 2y agoI still don't necessarily follow. I would expect them to be structs in the LISP DEFSTRUCT sense. Outside of somewhat fringe reasons, caring about allocation style is something I'd imagine most people just don't do?