Re:Is your JavaScript function actually pure?
by fenomas on Tuesday September 20, 2016 @11:01AM
(#12540028)
Haven't the faintest. I don't speak Haskell, 's why I asked.
I'd thought pureness was a property of function definitions, irrespective of what they get passed, but living in Javascript land I've never had occasion to be concerned with the distinction. I kind of suspect it's not really something that's useful to talk about.
Re:Is your JavaScript function actually pure?
by nilved on Tuesday September 20, 2016 @11:19AM
(#12540172)
Not asking you directly, I agree with you and was trying to rephrase the notion.
Re:Is your JavaScript function actually pure?
by tamana on Tuesday September 20, 2016 @11:41AM
(#12540350)
If you introduce unsafe into a program, it is not pure.
You can run a linter or something to check if your program uses unsafe anywhere.
Purity is a spectrum, not a binary, The more impurities you add, the more likely your program will not behave reasonably (as in, not in accordance with the simple logical rules of referential transparency).
For theoretical purposes it might make sense to say pure functions cannot call impure functions, but I think a more practical definition includes functions that are provided as arguments.