5 ms·
Is this about organizing side-effects in a way that compilers can optimize?
by macawfish 9y ago
Is this about organizing side-effects in a way that compilers can optimize?
- bsaul 9y agoI asked myself a bit of a related question. Is this theory related to https://en.m.wikipedia.org/wiki/Static_single_assignment_form https://en.m.wikipedia.org/wiki/Static_single_assignment_for... ?
- jw- 9y agoI think SSA is related to CPS, but I'm not sure of the correspondence with Linearity. I think the key difference (but I'm not sure), is that SSA only asserts that a variable is assigned once, but might be consumed multiple times. Linearity says that things must be consumed exactly once. For instance, I think: y <- x + 1 z <- x + 2 is a legal SSA expression, but it is not a legal linear expression because x appears twice. (Corrections welcome)
- kthielen 9y agoFWIW: https://www.cs.princeton.edu/~appel/papers/ssafun.ps https://www.cs.princeton.edu/~appel/papers/ssafun.ps
- jw- 9y agoI think you could say that. Another way to look at it would be to say it's about organising your code in such a way that side-effects don't really matter. For instance, if only I have access to a reference, then I'm free to update it without risk of disrupting anyone else's world view. You could say that there is no side-effect from my update because no-one can observe the change. This is nice for functional programming because it gives you the performance of mutable state and destructive update, but in a way that is 'pure', or side-effect free, from the outside.