Pure delegate not quite pure?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 30 15:29:01 PDT 2015


On Tuesday, 30 June 2015 at 22:23:40 UTC, Tofu Ninja wrote:
> On Tuesday, 30 June 2015 at 22:05:43 UTC, Steven Schveighoffer 
> wrote:
>> Have you tried placing const on the function signature? i.e.:
>>
>> pure int delegate() const d = () const {...
>>
>> That's how you'd do it (I think, didn't test) if the delegate 
>> context pointer was a class/struct.
>>
>> -Steve
>
> Nah, says its only available for non-static member functions.

Also wouldn't being able to annotate it immutable(also doesn't 
work) solve both problems. If the context was immutable then 
everything in it would have to be as well, d couldn't change it 
and foo wouldn't be able to as well because every thing in the 
context would have to be immutable. Or maybe I am understanding 
it wrong.


More information about the Digitalmars-d-learn mailing list