On Saturday, August 03, 2013 23:19:33 monarch_dodra wrote: > Thank the 3 of you for your answers. I think I had a wrong > preconception of what pure is. I think this cleared most of it up.
_All_ that pure does by itself is guarantee that the function doesn't access any static or global variables which can be mutated after they're initialized. Where it becomes more entertaining is when the function becomes strongly pure (which at this point requires that all of the functions parameters be immutable or implicitly convertible to immutable - though it really should be when the _arguments_ are immutable or implicitly convertible to immutable and all of the parameters are either const or immutable or implicitly convertible to immutable). At that point, certain optimizations become possible, but what exactly those optimizations are is still something that's up for debate (e.g. when you can get away with converting the return value to a different level of mutability and when you can't). - Jonathan M Davis