Const/Shared/Immutable anomalies in D that should be fixed

kenji hara k.hara.pg at gmail.com
Thu May 3 10:48:54 PDT 2012


It is bug 7038 and has been fixed in 2.059.
http://d.puremagic.com/issues/show_bug.cgi?id=7038

Kenji Hara
2012/05/03 15:04 "Mehrdad" <wfunction at hotmail.com>:

> I believe all of these static assertions (and some variants thereof)
> should pass, due to the semantics of const, immutable, and shared.
>
> immutable struct Immutable { }
> const struct Const { }
> shared struct Shared { }
> static assert(is(Immutable == immutable(Immutable)));
> static assert(is(Immutable == const(Immutable)));
> static assert(is(Immutable == shared(Immutable)));
> static assert(is(Const == const(Const)));
> static assert(is(Const == shared(Const)));
> static assert(is(Shared == shared(Shared)));
>
>
> Do people agree?
>
> Also, what exactly is the difference between declaring a struct as
> immutable or as const? Aren't they unmodifiable either way?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120504/3b2762c8/attachment.html>


More information about the Digitalmars-d mailing list