Read-only property without @property

H. S. Teoh via Digitalmars-d digitalmars-d at
Fri Sep 26 18:45:26 PDT 2014

On Fri, Sep 26, 2014 at 06:20:46PM -0700, H. S. Teoh via Digitalmars-d wrote:
> 	union U {
> 		void delegate() @system sysDg;
> 		void delegate() @safe safeDg;
> 	}
> Is this union @safe or not? Technically, it should be, since there's no
> possibility of getting an invalid pointer to delegate using U. However,
> it also breaks @safe-ty if you assign U.sysDg and call U.safeDg. (This
> is currently accepted by the compiler, btw. In @safe code.)

> And what of:
> 	union U {
> 		immutable int x;
> 		int y;
> 	}
> ? This one breaks the type system. It's certainly @safe, but has other
> issues. (The compiler happily accepts this one, BTW.)


It is the quality rather than the quantity that matters. -- Lucius Annaeus Seneca

More information about the Digitalmars-d mailing list