DIP77 - Fix unsafe RC pass by 'ref'
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 8 17:45:08 PDT 2015
On 4/8/2015 5:30 PM, deadalnix wrote:
> On Wednesday, 8 April 2015 at 23:11:08 UTC, Walter Bright wrote:
>> http://wiki.dlang.org/DIP77
>
> That is pretty much the old Rust solution called boxing. This sound like the
> right way forward to me.
Yes, it's equivalent to it. I had started with doing an INC/DEC pair, but that
implied adding more logic to detect how to do an INC/DEC for a particular type.
The logic for doing a copy is much more straightforward. The RC object should
also be designed in such a way that the copy is not costly.
Function purity is again showing what an advantage it is.
Andrei's idea was to not do the copy for @system opAssign's, thus providing C++
equivalence for those folks that need it and don't care about guaranteed memory
safety.
More information about the Digitalmars-d
mailing list