2 ms·
The author seems to not quite have figured out what he wants to say here: clearly he knows that JS purity is undecidable, Might I suggest looking into a subset
by devishard 10y ago
The author seems to not quite have figured out what he wants to say here: clearly he knows that JS purity is undecidable,
Might I suggest looking into a subsets of JavaScript where purity is decidable? It seems like the author is intuiting that purity is decidable for some nontrivial subset of JS (this is my intuition as well).
I think that we can determine cost variables assigned to a primitive value to be pure. From there we can build up that const functions which only contain pure expressions are pure. Note that this does not include fields on objects of any kind: a.b and a[b] are not necessarily pure even if both a and b are. In this way, I think we can determine that a subset of JS is pure. We can't, however, prove that any subset is not pure. Nevertheless, even proving a small subset to be pure might have implications for optimization.