Proposal: Relax rules for 'pure'

Steven Schveighoffer schveiguy at yahoo.com
Thu Sep 23 13:41:57 PDT 2010


On Thu, 23 Sep 2010 16:35:23 -0400, Tomek Sowiński <just at ask.me> wrote:

> dsimcha napisał:
>
>> 1.  The documentation that says that the parameters need to be  
>> convertible
>> to immutable is outdated.  This was changed a while ago to only  
>> requiring
>> const.
>
> Good to know. Yet, I wonder why such changes are not discussed on this  
> NG and at the very
> least announced in the change log...
>
> On topic: this means a pure function can take a reference to data that  
> can be mutated by
> someone else. So we're giving up on the "can parallelize with no  
> dataraces" guarantee on
> pure functions?

A const pointer to unshared data cannot be modified while inside a pure  
function.  The key is that it's unshared.

What it does disable is caching based on the reference value.

-Steve


More information about the Digitalmars-d mailing list