Weak Purity Blog Post

Jon D via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Mar 30 15:33:02 PDT 2016


On Monday, 28 March 2016 at 01:44:02 UTC, sarn wrote:
> D's implementation of functional purity supports "weak" purity 
> - functions that can mutate arguments but are otherwise 
> traditionally pure.
>
> I wrote a post about some of the practical benefits of this 
> kind of purity:
>
> https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html

Nice article. A suggestion: The point about improved testability 
when designing for purity is well made. In D, this is further 
supported by the ability to write and place unit tests alongside 
the functions themselves. That's my personal opinion at least - 
because unit test are so easy to write in D, it encourages design 
for testability.

My suggestion is to add a note about this to the post.

--Jon


More information about the Digitalmars-d-announce mailing list