DEV Community

Discussion on: Should Pure Functions Be Self-contained

Collapse
 
satansdeer profile image
Maksim Ivanov

But what if that function in global scope will be overridden by non-pure function?

Global scope can be altered from other parts of the code.

Collapse
 
geolamp profile image
George Lampadaridis

Yes then this function became not pure. So just like a var can change from a number to function, I believe a function can be rendered pure or not while it changes.

Thread Thread
 
satansdeer profile image
Maksim Ivanov • Edited

Then it looks like it's not the function that can be pure or not, but a function call.

So we can have pure function calls and impure function calls.

Thread Thread
 
geolamp profile image
George Lampadaridis

I have to agree

Thread Thread
 
satansdeer profile image
Maksim Ivanov

Would be awesome to summon some FP pro here to clarify the terminology.