4 ms·
The Expression Problem in Go
- wybiral 9y agoWhy don't you define Expr to be: type Expr interface { Eval() float64 } Instead of that being an empty interface and ditch the "Eval" interface? Or just require the structs to take instances of "Eval"? That way BinaryPlus won't accept the string without being wrapped in a type with an Eval method?
- saolof 9y agoInterestingly, Julia handles the type safety aspect with ease despite being dynamic, since it has both multimethods and parametric polymorphism.