OT: How to initialize *non-null reference* lazily? WAS: Re: Proposal : allocations made easier with non nullable types.
Denis Koroskin
2korden at gmail.com
Mon Feb 9 16:08:03 PST 2009
Note there exists an *very* similar issue - invariant/immutable variables initialization:
class Bar : Base
{
invariant this()
{
// how would you initialize _x and _y?
// they should be initialized before 'this' laves the scope
// and before super() ("Foo x()" might be called by base class)
}
invariant Foo x()
{
return _x;
}
private invariant Foo _x, _y;
}
My proposed rules apply to this situation quite the same.
More information about the Digitalmars-d
mailing list