|
|
|
|
|
by zelphirkalt
918 days ago
|
|
The idea is, that it decouples state from behavior, while a class tries to group that together. Other people can implement traits later for your struct. (I think Clojure has something similar.) They do not need to subclass your struct and in fact cannot even. This design encourages and kind of forces composition over inheritance. I would not name it a class, because I don't want people to fall back into thinking: "Ah I know! Inheritance!". |
|