immutable struct/class is mutable!

Dicebot public at dicebot.lv
Mon Jul 15 08:08:57 PDT 2013


On Monday, 15 July 2013 at 14:50:04 UTC, JS wrote:
> Why does isMutable and isAssignable return true for a 
> struct/class that are immutable?
>
> immutable struct A { }
>
> isMutable!A returns true.

looks like

immutable struct A
{
     int a;
}

acts as a

struct A
{
     immutable:
         int a;
}

Now, I don't see this use case (qualified aggregate definition) 
anywhere in spec and this may be intended behavior. But I do 
agree this looks misleading.


More information about the Digitalmars-d-learn mailing list