4 ms·
Since a function is just an object with a single 'apply' method, I agree with the spirit of your code. However, the concept is more naturally/idiomatically exp
by noblethrasher 15y ago
Since a function is just an object with a single 'apply' method, I agree with the spirit of your code.
However, the concept is more naturally/idiomatically expressed in C# using an abstract class and variants (i.e. derived classes) for the various states.
This also gives you the advantage that you can encode valid state transitions in the type system itself.