DIP77 - Fix unsafe RC pass by 'ref'

matovitch via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 11 05:35:42 PDT 2015


On Saturday, 11 April 2015 at 11:33:51 UTC, Marc Schütz wrote:
> On Saturday, 11 April 2015 at 09:41:07 UTC, Walter Bright wrote:
>> On 4/11/2015 2:28 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= 
>> <schuetzm at gmx.net>" wrote:
>>> It's not acceptable that it happens behind the user's back. 
>>> Costly operations
>>> must be explicit.
>>
>> Don't know of a better solution.
>
> How about this?
>
> http://wiki.dlang.org/User:Schuetzm/scope3#.40safe-ty_violations_with_borrowing
>
> Btw, I also made other changes: No implied scope for @safe 
> functions, no overloading on scope (instead postblit and 
> destructor are skipped), and added a terminology section 
> (rather important!).

Just passing, a bit off topic and clearly not familiar enough 
with the discussed subject but in case you missed it the last 
rust blog post is an nice and motivated introduction to their 
ownership system :

http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html

I need to read about Marc's scope proposal...I am not convinced 
by the dip77, what about raii managed classes with costly 
opAssign operator (like in w0rn example) ? The goal of passing an 
object by reference is to avoid the copy and here you guess the 
parameter is ref-counted and made a (pseudo-)copy ? Then any 
allocating opAssign should be marked @system ?


More information about the Digitalmars-d mailing list