A purity change
Maxim Fomin
maxim at maxim-fomin.ru
Thu Jul 11 11:08:55 PDT 2013
On Thursday, 11 July 2013 at 17:59:22 UTC, bearophile wrote:
> Maxim Fomin:
>
>> My guess is that before 2.063 immutable int y was implicitly
>> static, but now it is per instance data which requires context
>> pointer which is deduced to be impure - that why compilation
>> fails (try placing static attribute). In other words, before
>> 2.063 this was a function and now it is a delegate. And
>> delegates currently don't play well with
>> constness/immutability.
>
> I think you are right. So is it right to ask D to infer such
> delegate as pure?
>
> Bye,
> bearophile
I think delegate here can be allowed to be pure. However, I
wouldn't expect this issue to be fixed soon since it touches a
general problem of delegates vs. immutability problem. There were
many discussions and DIP but there is still no solution.
More information about the Digitalmars-d-learn
mailing list