dmd 2.063 beta 5

Steven Schveighoffer schveiguy at yahoo.com
Thu May 23 08:14:47 PDT 2013


On Thu, 23 May 2013 11:07:16 -0400, Dicebot <m.strashun at gmail.com> wrote:

> On Thursday, 23 May 2013 at 14:58:01 UTC, Steven Schveighoffer wrote:
>> Seems like const qualifier for members is simply ignored inside the  
>> ctor, it should only be ignored until it is set, or until it is used.
>
> I am quite sure I have seen it (mutability of immutable in constructor)  
> guaranteed either by spec or TDPL. Don't have TDPL with me right now,  
> need to check later.

I did check, though not thoroughly.  I think it only talks about actual  
immutable constructors (that is, initializing a fully immutable-qualified  
instance).  It doesn't really talk about immutable members.

And for immutable constructors, the rule seems to be that you can assign  
fields as many times as you want, but you cannot read them, or call any  
methods.

I think whatever rules are used, they should be consistent for  
immutable/const members as well.

-Steve


More information about the Digitalmars-d-announce mailing list