ModularM
Modular3y ago
42 replies
david

Will Mojo solve the Expression Problem?

As a software developer I want to apply Solid Design Principles to Mojo.
The open closed principle states that software entities should be open for extension but closed for modification.
In case of OOP operations are fixed but new types are introduced through vertical extension(inheritance)
In functional programming types can be fixed and new operations are introduced through horizontal extension(pattern matching)
Depending on the problem domain one over the other can be better for example if a compiler has fixed types and always new operations should be introduced on these types pattern matching might be better.
This would make Visitor pattern part of the language.
There is also I think a approach with Typeclasses in Haskell, which allows extension easily in both directions without violating ocp ,thus tries to solve the expression problem.
Was this page helpful?