Read-only property without @property

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 26 20:45:12 PDT 2014


On 9/26/14, 6:18 PM, Steven Schveighoffer wrote:
> 1. A union of any number of non-reference types with the same mutability
> throughout is @safe, even if the type varies.
> 2. A union of two non-reference types, in which one union member has
> some bytes defined as mutable, and another union member has those same
> bytes defined as immutable, is un- at safe. Const union members will not
> disqualify the union.
> 3. A union of any number of pointer types which point at the same type,
> but vary only by const, are @safe, unless at least one member is mutable
> and at least one member is immutable.
> 4. Everything else is un- at safe
>
> This may break some code, but I think it would define good starting
> rules to allow this in @safe code.

Nice! We need a complete set of rules for this stuff. -- Andrei


More information about the Digitalmars-d mailing list