RFC: scope and borrowing

via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 23 03:26:27 PDT 2014


On Tuesday, 23 September 2014 at 10:16:26 UTC, Marc Schütz wrote:
> On Tuesday, 23 September 2014 at 09:17:48 UTC, bearophile wrote:
>> Marc Schütz:
>>
>>> http://wiki.dlang.org/User:Schuetzm/scope
>>
>> If a mutable argument of a function is tagged as unique, the 
>> type system guarantees that there are no other references to 
>> it. So can a function 'foo' like this be "strongly pure"?
>>
>>
>> int[] foo(unique int[] a) pure {
>>    a[0]++;
>>    return a;
>> }
>
> I think so.

Ok, I take it back ;-) Steven is right. It is however the case 
that this function's return value would still be unique.


More information about the Digitalmars-d mailing list