change 'this' pointer for structs to reference type

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Nov 2 09:41:08 PST 2008


Robert Fraser wrote:
> Andrei Alexandrescu wrote:
>> Robert Fraser wrote:
>>> Walter Bright wrote:
>>>> Andrei suggested this change, and I think it is a great idea. D 
>>>> ought to be moving away from pointers for routine work, and this 
>>>> would make a lot of sense.
>>>>
>>>> It would entail some changes to user code, mostly when dealing with 
>>>> the opCmp and opEquals member functions. The function signatures for 
>>>> them would be changed to opCmp(ref const S).
>>>
>>> While we're at it, let's have "in" return a reference instead of a 
>>> pointer for AAs.
>>
>> Unfortunately that won't be possible because references can't be null.
>>
>> Andrei
> 
> Ah, I see. But then what about the "no pointers in SafeD" thing... does 
> this mean SafeD will also lack the "in" operator?

It means we'll have to redesign "in".

Andrei



More information about the Digitalmars-d mailing list