Pure delegate not quite pure?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 30 14:44:59 PDT 2015


On Tuesday, 30 June 2015 at 21:31:05 UTC, Steven Schveighoffer 
wrote:
> On 6/30/15 5:23 PM, Tofu Ninja wrote:
>> On Sunday, 28 June 2015 at 10:19:05 UTC, anonymous wrote:
>>> [...]
>>
>> Is there any way to annotate the context as const?
>
> const x = 4 ;)
>
> But even if you could annotate just the *reference* as const, 
> it doesn't stop foo from changing it as you did in the example.
>
> -Steve

Yeah, but I am more worried about d changing x by itself(though 
foo changing it is still a problem), I have a piece of code that 
takes a delegate and I want to ensure that it runs in the same 
way every time once it's given to me.


More information about the Digitalmars-d-learn mailing list