change 'this' pointer for structs to reference type
Janderson
ask at me.com
Sun Nov 2 00:37:34 PDT 2008
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).
I never understood why struct's in D worked this way. When I initially
went to use D structs I assumed 'this' would behave in the same way as
classes. Making 'this' a reference type for struct's makes sense to me.
Of course it does mean another code breaking feature like you said.
-Joel
More information about the Digitalmars-d
mailing list