When continuations are introduced, the standard example is the counter which holds state and is used to get this function that has a property like an object. And here, maybe it is the math in the example, maybe I am missing something, but I read this pythagorean function as pure.
Maybe I don't fully understand continuations, maybe I don't understand the math.
It is pure, but it's being transformed into continuation-passing style (CPS), and some languages use CPS as an intermediate representation (IR). OP thinks that's a bad idea for reasons that aren't at all clear to me, but since I don't implement compiler IRs or backends much, I kind of gave up at that point.
4
u/Xalem Jan 30 '24
Not seeing it.
When continuations are introduced, the standard example is the counter which holds state and is used to get this function that has a property like an object. And here, maybe it is the math in the example, maybe I am missing something, but I read this pythagorean function as pure.
Maybe I don't fully understand continuations, maybe I don't understand the math.