Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 18 07:22:46 PDT 2013


On 5/18/13 7:13 AM, Simen Kjaeraas wrote:
> On Sat, 18 May 2013 09:14:30 +0200, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> On 5/18/2013 12:08 AM, deadalnix wrote:
>>> On 5/17/13, Walter Bright <walter at digitalmars.com> wrote:
>>>> I oppose this. D has a lot of nice features because of the .init
>>>> property.
>>>> Default constructors wreck that.
>>>
>>> So much great feature like :
>>> - null all over the place.
>>> - Having NUllable and NonNullable in phobos. BTW, NonNullable is
>>> unable to
>>> ensure that it if effectively non nullable.
>>> - Having to check for .init state all over the place (which have a
>>> runtime
>>> cost, in addition to be error prone). RefCounted implementation is
>>> emblematic of
>>> that.
>>
>> What default would you use for non-null pointers?
>
> Damnit, I thought we'd gotten through to you. non-null pointers have no
> default, and it is a compile-time error not to initialize them.

This is what I call the "low potential energy mental block". Very hard 
to get out of.

Andrei


More information about the Digitalmars-d mailing list