4 ms·
In fact, the command pattern is the opposite in a certain way. Defunctionalization corresponds to deeply embedded DSLs, whereas the command pattern corresponds
by choeger 7y ago
In fact, the command pattern is the opposite in a certain way. Defunctionalization corresponds to deeply embedded DSLs, whereas the command pattern corresponds to shallowly embedded DSLs.
In a proper functional language, you do not need objects for the latter, as you can directly compose functions.
That being said, the ability to add more operations than just "execute" to your commands allows you to emulate the features of deep embedding (e.g., serialization). But you have to extend every command for a single new operation (read up on the expression problem). That style is known as tagless in the FPL community, btw.