RFC: scope and borrowing

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 21 23:00:04 PDT 2014


On 9/21/2014 2:11 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> On Sunday, 21 September 2014 at 03:39:24 UTC, Walter Bright wrote:
>> I think it's a well thought out proposal. Thanks for doing this!
>>
>> A couple thoughts:
>>
>> 1. const can be both a storage class and a type constructor. Scope is only a
>> storage class. The scope(int) syntax implies scope is a type constructor, too.
>>
>>     const int* a;  // const used as storage class
>>     const(int*) b; // const used as type constructor
>>
>> The type constructor syntax should be disallowed for const.
>
> (... disallowed for _scope_, I assume)

Yes, my mistake.


> I originally intended it to be part of the type. Ivan Timokhin pointed out
> severe problems with that [1], so I removed it from the proposal. The syntax is
> a remainder of that.
>
> But before I remove it too, I have a question: Will it still be possible to use
> the storage class syntax for members of aggregates?
>
>      struct S {
>          scope!myAllocator int* p;
>      }

Possible, but exactly how that would work remains to be seen.




More information about the Digitalmars-d mailing list