On Sunday, 22 May 2016 at 13:08:19 UTC, Jonathan M Davis wrote:
Given how const and immutable work in D, having any portion of
them be treated as mutable, becomes highly problematic. It
could theoretically be done by having to mark such variables
with an attribute and mark such types with a similar attribute
so that the compiler knows that the type in question is not
really following the rules of const or immutable and thus
doesn't make any assumptions about it like it would normally,
but it risks getting rather complicated, and Walter is most
definitely not in favor of such an idea. He is absolutely
adamant that const is useless unless it's fully const with no
backdoors whatsoever. So, I'd be very surprised if any kind of
@mutable were added to the language. Certainly, you'd have to
have a very strong technical reason to convince him otherwise,
and odds are that he's just going to tell you to not use const,
if it's not going to work for the type to be const.
Ha-ha. All this does not prevent immutable class to have mutable
monitor. Why D so often violates its own rules?