Head Const

Marc Schütz via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 21 05:39:01 PST 2016


On Friday, 19 February 2016 at 21:53:16 UTC, Walter Bright wrote:
> On 2/19/2016 4:38 AM, Jonathan M Davis wrote:
>> Why not? I would expect the opaque type to have to have it 
>> too, e.g.
>>
>>      @mutable struct S;
>
> That would mean you're proposing '@mutable const' as a type 
> constructor, which you'd earlier said otherwise.

That's not a type constructor though, it's a type annotation. A 
declaration like

     @mutable(S) s;

would not be allowed. Neither as a storage class in function 
signatures or for locals:

     void foo(@mutable S s) {   // ERROR
         @mutable const int i;  // ERROR
     }

What _is_ allowed is @mutable as a storage class (?) for members 
only:

     struct S {
         @mutable int x;
     }




More information about the Digitalmars-d mailing list