3 ms·
Declarative vs. procedural is orthogonal to data oriented vs. object oriented. The functional way to make a declarative interface would be to have a single typ
by hexane360 3y ago
Declarative vs. procedural is orthogonal to data oriented vs. object oriented.
The functional way to make a declarative interface would be to have a single type, `Expression`, and all operators take expressions and return expressions.
However, I would argue the declarative vs. procedural decision is much more important to the resulting code structure then whether you use a single object type or multiple object types with inheritance.
- gloryjulio 3y agoThe problem is that with python oop, the class is ur type. Therefore it comes with all the oop baggages. If u squint enough and avoid those baggages and only leverage the type system(hint), then it's kinda usable. U don't have much choices anyway.
- vore 3y agoIt's complicated because PyTorch also uses class syntax to allow you to introspect the various blocks in your modules. It's a bit of a kludge, but composing it strictly out of Expressions would remove that introspection capability.