Pure functions

Should we add support for recognition of pure functions? These functions don’t refer to any global state; their return values / outgoing in-out parameter states depend solely on the incoming argument values. I know at least the D programming language acknowledges them.

- Should they be marked with a “pure” attribute?
- How much checking should the complier do on code for purity violations?
- Should purity be a potential requirement on protocol methods?
- What kinds of optimizations are possible?
- What default built-in or standard library support should be pure as an initial set to build your own pure functions?

···


Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

4 Likes

I remember the purity wars like it was only last year.

As discussed in other conversations, it'd be nice if the person who's resurrecting old threads would kindly link to those previous threads and summarize the discussion to date.

We've had not one but several, very lengthy discussions on this topic. Please help the community catch up on those with a digestible summary so that everyone's hard work in the past doesn't have to get rehashed.

3 Likes