Fwd: Identifying pure (or "pure within a scope") JavaScript functions?

Peter Jaszkowiak p.jaszkow at gmail.com
Thu Dec 7 16:33:19 UTC 2017


How would "purity" be determined? Would it depend on if the function is a
closure on any outer scope? Would it depend on whether the function mutates
any objects passed to it? What counts as mutation?

It seems like it might be better, instead of having `isPure`, being more
barebones. There are a lot of attributes a function can have. `isClosure`
might be useful, etc.

ger than the callback, that might also be safe for not wrapping in the
membrane.  I'm thinking of a DOM NodeFilter object where the acceptNode
method modifies the filter, but the filter is defined via a let statement
in a small scope statement-block.  Since I don't know what to call this
kind of function, I'll temporarily call it "pure within a scope" until
someone corrects me.  What I mean by "pure within a scope" is that the
function's only side effects involve objects within that set.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171207/6bf90504/attachment.html>


More information about the es-discuss mailing list