purity question

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 30 06:49:27 PDT 2017


Rene Zwanenburg wrote:

> On Tuesday, 30 May 2017 at 11:34:52 UTC, ketmar wrote:
>>> If malloc were marked as pure, wouldn't that mean it must return the 
>>> same pointer every time you call it with the same size?
>>
>> of course. but D "pure" is not what other world knows as "pure". we love 
>> to mess with words.
>
> Well, there's the ability to modify non-const reference parameters from a 
> pure function, but that's not applicable to malloc. Are there any other 
> special rules?

"pure" methods can mutate object state.


More information about the Digitalmars-d-learn mailing list