Non-null objects, the Null Object pattern, and T.init

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 16 18:13:27 PST 2014


On 1/16/14 6:11 PM, Adam D. Ruppe wrote:
> On Friday, 17 January 2014 at 02:04:27 UTC, Andrei Alexandrescu wrote:
>> Yah, that would be expected.
>
> Yeah, but I think people would find it weird. This kind of thing is
> actually possible today:
>
> class Foo { }
>
> class Bar {
>          Foo foo = new Foo(); // this gets a static reference into the
> typeinfo.init (since new Foo is evaluated at compile time!) which is
> blitted over...
> }

That wouldn't be allowed.

Andrei



More information about the Digitalmars-d mailing list