DIP77 - Fix unsafe RC pass by 'ref'

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 03:29:17 PDT 2015


On 4/10/2015 3:02 AM, Martin Nowak wrote:
> On Wednesday, 8 April 2015 at 23:11:08 UTC, Walter Bright wrote:
>> http://wiki.dlang.org/DIP77
>
> So someone passes an RCO via ref to avoid the inc/dec, and because that imposes
> safety issues we turn it into some sort of pass by value under the hood,
> defeating the purpose, and provide an opt-out via @system opAssign.

Or you could pass it by const ref (which is what Rust essentially does).


> Wouldn't it more straightforward to make pass-by-ref unsafe (@system) for RCOs?

That's what we have now. It's not good enough.



More information about the Digitalmars-d mailing list