On 06/19/2012 07:47 PM, Christophe Travert wrote:
Timon Gehr , dans le message (digitalmars.D:170185), a écrit :
On 06/19/2012 07:18 PM, Christophe Travert wrote:
In 2., mutable data referred to by a const reference might be changed
through it.

Then it is not a const reference, it is a normal reference. Qualifying
the reference as 'const' does not by you anything at all. Of course it
should not change immutable data, no delegate should do that !

You might state that frame pointer are opaque, have no const qualifier,
and that any delegates is callable even if they are in a const
structure. But saying a reference (frame pointer) can be const AND
modify data is a bit weird.


I am not saying that. I am saying that a 'const' delegate can contain a
non-'const' frame pointer without breaking the 'immutable' type
qualifier, because the delegate is type checked modularly at its
creation site.

It is a const reference to a structure that contains such a delegate that will fail to deliver any guarantees in case it refers to data that is not 'immutable'. Opaque delegate context pointers effectively break the transitivity of 'const', but not the transitivity of 'immutable'.

Reply via email to