Non-null objects, the Null Object pattern, and T.init
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Jan 16 18:14:14 PST 2014
On 1/16/14 6:09 PM, Peter Alexander wrote:
> On Friday, 17 January 2014 at 02:07:08 UTC, deadalnix wrote:
>> Most object don't have a sensible init value. That is just hiding
>> the problem under the carpet.
>
> That's true.
>
> class Widget
> {
> Widget parent;
> static Widget init = ???
> }
>
> How do you define init?
Depends on what you want. Could be null or could have itself as a
parent. The null object pattern is what it is.
Andrei
More information about the Digitalmars-d
mailing list