javascript-compiler-hints / compiler-notations-spec

(Draft) Specifications for `__PURE__` compiler notation et al.
103 stars 3 forks source link

Better explain how pure is different from side effect free #3

Open calvinmetcalf opened 1 year ago

calvinmetcalf commented 1 year ago

It took me a couple readings to realize pure no use of closures. Making it more explicit what the two things do would by helpful. My understanding:

antfu commented 1 year ago

I agree. But I feel that the problem is that __PURE__ is used on expressions, but not on function declarations, which does not apply to the statement you mentioned?

From my understanding:

So there is actually no "pure function" concept involved.

robpalme commented 1 year ago

The semantic relationship I have always understood is:

I agree this relation should be clarified somewhere.