4 ms·
> classes are a bad way to model data imo Genuinely curious: why?
by thenaturalist 1y ago
> classes are a bad way to model data imo
Genuinely curious: why?
- xigoi 1y agoNot the one you’re replying to, but my take: The main problem with classes is that they conflate a lot of concepts that should be separate and you usually need only one or a few at once, but are 5orced into all of them. Namely: • Product type • Reference semantics • Namespacing • Pipeline-style call syntax • Redefinition of infix operators • Dynamic dispatch • Subtyping For example, you cannot have a product type with value semantics or a type that redefines infix operators but is not a product type.