What's this? (Was: DMD 1.028 and 2.012 releases)
Bill Baxter
dnewsgroup at billbaxter.com
Fri Mar 7 02:51:25 PST 2008
Aarti_pl wrote:
> Walter Bright pisze:
>> Aarti_pl wrote:
>>> Did you notice this example in docs?
>>> (http://www.digitalmars.com/d/2.0/struct.html#AssignOverload)
>>>
>>>
>>> S* opAssign(S s)
>>> { S tmp <== *this; // bitcopy *this into tmp
>>> *this <== s; // bitcopy s into *this
>>> tmp.~this(); // call destructor on tmp
>>> return this;
>>> }
>>>
>>> It seems to be something new in D 2.012. Does it work? How?
>>
>> It's pseudo-code. There is no <== operator nor .~this() in D. I
>> probably made a mistake in presenting it this way, but I was trying to
>> show what was going on.
>>
>> The comments explain what is happening.
>
> Yes, such a pseudo-code should probably be avoided.
>
> I thought that there was silently introduced special copy operator.
> ... the one that would disambiguate ref copying from object copying for
> example :-)
Ohh that's not real code? That is confusing. Just put the pseudocode
into comments then it won't be as misleading.
--bb
More information about the Digitalmars-d-announce
mailing list