4 ms·
Nowhere does it say structs provide “one source of truth”. It says the opposite actually- that classes are to be used when unique instances are required. All cl
by fingerlocks 8mo ago
Nowhere does it say structs provide “one source of truth”. It says the opposite actually- that classes are to be used when unique instances are required. All classes have a unique ID, which is simply it’s virtual memory address. Structs by contrast get memcpy’d left and right and have no uniqueness.
You can also look at the source code for the language if any it’s confusing. It’s very readable.
- mvdtnz 8mo agoYou're re-stating his exact problem while trying to refute him.
- fingerlocks 8mo agoNo, I’m not. OP is conflating multiple guidelines for different purposes and attempting to use them all simultaneously.
- zephen 8mo ago> OP is ... attempting to use [multiple guidelines] simultaneously. No, he's literally explaining why the guidelines can't be used simultaneously.
- fingerlocks 8mo agoThey aren't supposed to be used simultaneously, which is literally what my comment was explaining. Different guidelines to solve different problems.
- zephen 8mo agoHave one source of truth is a universal guideline. Prefer structs over classes is a universal, if weak, guideline. It's funny how people can be all hung up on composability of things like type systems, and then completely blow off the desire for composability of guidelines.