What are (dis)advantages of using pure and immutable by default?

Bahman Movaqar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 7 03:40:52 PDT 2015


It seems to me a good practice to mark all functions that I write 
as `pure` and define all the variables as `immutable`, unless 
there is a reason not to.
I can see some serious advantages of this, most notable of which 
is minimum side-effect and predictability of the code.  However I 
suppose it's going to impact the performance and memory footprint 
as well, though I have no idea how deep the impact will be.

I'm pretty sure I'm not the first one to think about this; so 
what would you seasoned D'ers say?



More information about the Digitalmars-d-learn mailing list