How to use pure in D 2.0 question on Stack Overflow?

Jason House jason.james.house at gmail.com
Wed Jun 17 20:09:02 PDT 2009


Jeroen Dirks Wrote:

> Does anyone know the answer to this D related question on SO?
> 
> http://stackoverflow.com/questions/1008803/how-to-use-pure-in-d-2-0/

addMsg is not marked pure and pure functions can't call impure functions... I'm not sure if addMsg can be marked pure or not. It does not touch global state but does have side effects. The key is if side effects to on the containing object or not. (I haven't used pure enough to know. Many functions in Phobos are not marked as pure even though they could be. That limits pure's use for me)



More information about the Digitalmars-d mailing list