Read only delegate
Edwin van Leeuwen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 4 05:04:56 PDT 2016
On Monday, 4 April 2016 at 11:39:55 UTC, Kagamin wrote:
> On Monday, 4 April 2016 at 11:32:23 UTC, Rene Zwanenburg wrote:
>> https://issues.dlang.org/show_bug.cgi?id=1983
>
> Bug 1983 is about usage of delegates after creation,
> restrictions during creation are enforced. AIU, OP wants to
> have const check during creation.
I think the underlying issue is the same. The problem seems to be
that:
> Unfortunately, there is no way to declare a const delegate (by
> which I mean, a delegate whose context pointer is typed const).
I actually discovered the problem, due to the hole it leaves in
the const system, where I got different results calling a const
method multiple times. The const method in question called a
delegate that changed its context pointer, resulting in changes
during calls.
More information about the Digitalmars-d-learn
mailing list