Head Const

Marc Schütz via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 21 05:30:57 PST 2016


On Friday, 19 February 2016 at 06:39:53 UTC, Walter Bright wrote:
> Allow @mutable, and no more mechanical checking in D. Recall 
> that D supports opaque types, meaning types are not fully known 
> to the compiler.

Allow @trusted, an no more mechanical checking in D. Recall that 
D supports extern functions, meaning function bodies are not 
fully known to the compiler.

Seriously, yes, @mutable is not mechanically checkable, which is 
why it is @system. That's intended, and not a flaw. It is 
supposed to make it possible to express things that don't 
otherwise fit the type system, and still be reasonably safe.

Jonathan's idea of attaching @mutable to the declaration handles 
the problem of opaque data structures really well. We can debate 
whether we require that annotation every time a struct contains 
@mutable members (even indirectly) to make it more obvious (if 
so, it still needs to be inferred for templated types), or if it 
should only be required for opaque types.


More information about the Digitalmars-d mailing list