References in D

deadalnix deadalnix at gmail.com
Mon Sep 17 13:13:59 PDT 2012


Le 17/09/2012 19:07, Andrei Alexandrescu a écrit :
> On 9/17/12 12:41 PM, deadalnix wrote:
>> Le 17/09/2012 15:12, Andrei Alexandrescu a écrit :
>>> On 9/17/12 6:52 AM, deadalnix wrote:
>>>>> Regardless, the solution at this point is going to be to add
>>>>> std.typecons.NonNullable. It would be in there already, but the pull
>>>>> request
>>>>> with it needed more work, and it hasn't been resubmitted yet.
>>>>>
>>>>
>>>> I don't think this is implementable as a lib in a satisfying way.
>>>
>>> It is, but it needs just a bit of language support in constructors.
>>> Walter never got around to it.
>>>
>>> Andrei
>>
>> So it isn't. That was my point. You need the compiler to help you on
>> that one.
>
> I don't think that was your point. My understanding is that your point
> was that (a) with or without @disable, one cannot implement NonNull
> pointers in the library, and (b) there is need for _specific_ support
> for NonNull in the language. Our position is that NonNull is only one of
> several instances of a much more general pattern, which can be addressed
> with @disable once it is properly tracked inside constructors.
>
>
> Andrei

Quoting myself : « I don't think this is implementable as a lib in a 
satisfying way. » (assuming, in the current state of things)

I made other point in other posts, but in that one, I just say that non 
nullable references require compiler support in some way compared to 
what we have now.

This support can be reserved to non null, or can be a larger problem 
(like @disable as you mention) that allow to solve the non null problem. 
I don't see how what I write limit things on that topic.


More information about the Digitalmars-d mailing list