DIP74: Reference Counted Class Objects

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 17:43:01 PST 2015


On 2/26/15 5:37 PM, H. S. Teoh via Digitalmars-d wrote:
> On Fri, Feb 27, 2015 at 12:59:38AM +0000, ketmar via Digitalmars-d wrote:
>> On Thu, 26 Feb 2015 13:50:55 -0800, Andrei Alexandrescu wrote:
>>
>>> http://wiki.dlang.org/DIP74 got to reviewable form. Please destroy
>>> and discuss.
>>>
>>> Thanks,
>>>
>>> Andrei
>>
>> this stinks in the same way as DIP25 stinks. right here: "Attention
>> must be paid to annotate all functions returning references to owned
>> data with return." this single thing will bring enormous pile of bugs.
> [...]
>
> Wait, are you saying that forgetting the 'return' annotation will still
> compile without any warning?? Wow, that's ... not nice. :-(

The compiler will issue errors if returning ref to direct members. There 
won't be errors with returning ref to owned indirect members that the 
class deallocates manually. -- Andrei




More information about the Digitalmars-d mailing list