Side-effects create dependencies

DAxelrod on 2006-10-26T21:08:58

All this discussion of side-effects has reminded me of something.

A particular bit of code has, potentially, a return value, and side-effects. Other parts of the program have a dependency on a bit of code if they rely on either the code's return value, or side-effects. Think of return values as explicit dependencies, and side-effects as implicit dependencies.

Purely functional programming languages are easier to paralellize because all of the dependencies in the code are explicit.

It would seem that parallelization of non-functional programming languages would be possible (without explicit design by the programmer) if we had a better way of analyzing code to map out dependencies.

I'll expand on this a little bit when I have more time.


Flow

chromatic on 2006-10-27T06:27:07

Are you perhaps thinking of data-flow analysis? You can reason about it even with return values, but it can get complex to traverse certain graphs....

Re:Flow

DAxelrod on 2006-10-27T17:22:46

Aha! I figured I was reinventing *some* principle of computer science, I just didn't know what it was called. Thanks for that link!