dereferencing null

Chad J chadjoan at __spam.is.bad__gmail.com
Wed Mar 7 17:55:02 PST 2012


On 03/07/2012 07:39 PM, Timon Gehr wrote:
> On 03/08/2012 01:24 AM, Chad J wrote:
>
>> Though, more to the point:
>> I would probably forbid "Foo foo = new Foo(this);". The design that
>> leads to this is creating circular dependencies, which is usually bad to
>> begin with.
>
> Circular object references are often justified.
>
>> Would we lose much of value?
>
> Well this would amount to forbidding escaping an object from its
> constructor, as well as forbidding calling any member functions from the
> constructor. Also, if you *need* to create a circular structure, you'd
> have to use sentinel objects. Those are worse than null.
>

OK, that does sound unusually harsh.


More information about the Digitalmars-d mailing list