r/javascript • • Aug 27 '16

Is your JavaScript function actually pure?

http://staltz.com/is-your-javascript-function-actually-pure.html
8 Upvotes

48 comments sorted by

View all comments

12

u/memeship Aug 27 '16

• The elements in the array don’t have their valueOf functions tampered with

This possibility means literally nothing in JS is pure.

Also, why the hell does this arbitrary designation matter? Programmatic functions are not mathematical functions, their purpose is completely different.

-1

u/vinnl Aug 28 '16

why the hell does this arbitrary designation matter?

My main takeaway, as I commented elsewhere, was that

there's more to purity then we often assume; that purity is a scale, and that e.g. types can help us edge a little bit more to the pure side of that scale.