Why do "const inout" and "const inout shared" exist?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 3 00:22:08 PDT 2017


On Monday, 3 July 2017 at 01:15:47 UTC, Walter Bright wrote:
> D const is different in that the compiler is allowed to 
> generate code as if const was never cast to immutable. Such 
> casts are also not allowed in @safe code.

You probably meant mutable, but how does that bring any 
advantages if any other thread can mutate it?

Seems like you would want something closer to Pony's or Rust's 
type system to gain any real benefits in terms of optimization.



More information about the Digitalmars-d mailing list