Hi All,
One of my favorite features in rust/rust rust analyser is the really strong control over where/when variables are mutable and the fact that rust analyser underlines mutable variables so you can tell immediately if you are dealing with a mutable or immutable variable.
Considering rust has excellent support for functional programming in the language and community I was wondering if there is anything similar for functions so you could tell at a glance if you are dealing with a pure or impure function. Ideally this would also apply to methods (as due to rust not having inheritance methods are pretty much just syntax sugar for passing a struct into a function).
Definition:
For the purposes of this discussion by a "pure" function I mean one which does not have side effects and where output is determined solely by input. Though if there's something which uses a slightly different definition that's grand too.
Thanks
Clarification:
To clarify from SkiFire13's comment about conditionally pure functions.
The issue I see with this is how to handle functions that are conditionally pure. For example is
Option::map
pure? It might not, if the closure passed to it is not pure.
What I am looking for is a tool which can evaluate that so a call containing only pure functions will show up as pure but one containing impure functions will not. FP is great but sometimes you need/want impure code for certain applications. I want to know which parts of my code are functional and which aren't