change 'this' pointer for structs to reference type

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Nov 2 09:43:20 PST 2008


Denis Koroskin wrote:
> On Sun, 02 Nov 2008 10:01:24 +0300, Walter Bright 
> <newshound1 at digitalmars.com> 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).
> 
> Could you please clarify what do you mean (I don't get it). Does this 
> mean that all structs are heap-allocated by default? Or typeof(this) == 
> S* or what?

I think "typeof(this) == S*" is the current situation. What they're 
suggesting is "typeof(this) == ref S".

It has my vote, by the way.



More information about the Digitalmars-d mailing list