Grafting Functional Support on Top of an Imperative Language

Christopher Wright dhasenan at gmail.com
Sat Apr 5 07:09:14 PDT 2008


Craig Black wrote:
>> I suspect that ultimately, a go-between "possibly pure"* qualifier for 
>> functions will be desirable, just as const acts as "possibly invariant".
>> But that's just a hunch.
>>
>> *an amoral function -- pure if used in pure surroundings, impure if 
>> surrounded in bad company. <g>
> 
> Huh?  Is this just a joke or are you being serious?  Are you talking 
> about a templated function?  I don't see the point of "possibly pure".
> 
> -Craig

If you have a pure function, it must only take invariant arguments, and 
it can be automatically parallelized.

If you have a function that is amoral, it would be pure if you gave it 
all invariant arguments, but you could give it const or mutable 
arguments as well.

An amoral function has all the same contracts as a pure function, but 
none of the limitations on its arguments.



More information about the Digitalmars-d mailing list