If we used Immutable then we could:
- Skip further processing if a handler's output is unchanged.
- Update all derived handler inputs after each handler has run (this means less copying, since only a subset of a handler's input properties are likely to have changed).
- Only run a handler if it's input properties have changed.
- Know that the handler hadn't interfered with the input it had been given.
The upshot of this would be that, a summation-handler that is currently implemented like this:
function summationHandler(['x', 'y'], ['sum'], function(input, output, prevInput, prevOutput) {
output.sum = input.x + input.y;
})
would now be implemented like this:
function summationHandler(['x', 'y'], ['sum'], function(input, output, prevInput) {
return output.set('sum', input.get('x') + input.get('y'));
})
If we switch to using recursion instead of iteration (as per #34), then we'd need to tie this in with the need to invoke output.apply(), so the code would need to be written like this instead:
function summationHandler(['x', 'y'], ['sum'], function(input, output, prevInput) {
output.set('sum', input.get('x') + input.get('y')).apply();
})
If we used Immutable then we could:
The upshot of this would be that, a summation-handler that is currently implemented like this:
would now be implemented like this:
If we switch to using recursion instead of iteration (as per #34), then we'd need to tie this in with the need to invoke
output.apply(), so the code would need to be written like this instead: