4 ms·
That's an interesting comparison. On one hand, it feels similar, especially if the Command class is "sealed". On the other hand, it feels like completely the
by bogdanoff_2 7y ago
That's an interesting comparison.
On one hand, it feels similar, especially if the Command class is "sealed".
On the other hand, it feels like completely the opposite since the command classes contain the code they execute and act like lambdas.
I guess you could apply a visitor pattern on top of the command pattern to make it truly like defunctionalization. I hope nobody actually does this.
- lidHanteyk 7y agoYou're just describing an AST interpreter. Not only do people do this, but it's a reasonable thing to do.