Memory allocation purity

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu May 15 14:48:16 PDT 2014


On 05/15/2014 03:06 PM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Thursday, 15 May 2014 at 12:37:22 UTC, w0rp wrote:
>> To consider the design of pure, you must first consider that you
>> cannot add functional purity to an imperative language.
>
> Of course you can. Functional languages execute in an "imperative
> context".  That's why you need monads.
> ...

Strictly speaking you don't "need" monads, they are sometimes just an 
adequate way of structuring a program.

> The term "pure function" is only needed in a non-functional language.
> Applicative/functional languages only have mathematical functions, no
> need for the term "pure" there.

In discussions about e.g. Haskell, it is often used to denote an 
expression of a specific form inside a `stateful' DSL. E.g. if "η" is 
the unit of some monad, then (η v) is sometimes called a "pure value", 
while values of other forms are not called pure.


More information about the Digitalmars-d mailing list