3 ms·
What's the problem that is actually trying to be solved? The user of your implementation will inform the design choices you make. Using functions to represent
by silentOpen 17y ago
What's the problem that is actually trying to be solved? The user of your implementation will inform the design choices you make.
Using functions to represent objects like this is rather silly because they are opaque and only support a single operation.
Here are a number of possibly better ways to do it:
- Emulate objects with functions and messages like with scheme or lisp.
- Use structural typing or polymorphic variants like in OCaml.
- Use records with function fields.
- Use a variant union.
- Extend/build a list monad over your class.
Can you think of other or better ways?
- deleted 17y ago[deleted]