Re:Data-oriented design or why you might shoot yourself in t...
by hcarvalhoalves on Wednesday June 30, 2021 @10:52AM
(#27689255)
> There is an implicit subject you are asserting facts about though. You clearly are talking about a fluffy, white Cat in your example.
No, I'm not, because I didn't assert this fact (it's a Cat).
See how hard it is to break free from this mindset of objects.
Re:Data-oriented design or why you might shoot yourself in t...
by meheleventyone on Wednesday June 30, 2021 @02:40PM
(#27692041)
Right as I said it’s structural typing. It’s implicit that the traits are grouped together to describe something. And individual traits could be grouped together with completely different ones to describe something else. That you choose not to name it doesn’t change that the trait collection applies to fluffy, white Cats whether you like that or not. I can even choose to call it one thing and you can choose to call it something else and the types will remain interchangeable. You can even leave your type anonymous and it will still be interchangeable.
Structural typing is really cool though. An object built from a named, saved recipe will work just as well as something cobbled together on the fly and at runtime you won’t even know which is which. It’s the basis of a lot of general purpose game engines composition based game object interface.
I’ve also found it extremely fun to use with TypeScript.