Mutable enums
    so 
    so at so.so
       
    Mon Nov 14 01:20:30 PST 2011
    
    
  
On Mon, 14 Nov 2011 10:27:21 +0200, Timon Gehr <timon.gehr at gmx.ch> wrote:
> It is the right design. Why should enum imply const or immutable? (or  
> inout, for that matter). They are completely orthogonal.
>
> enum Enum{
>      opt1,
>      opt2,
> }
>
> void main(){
>      auto moo = Enum.opt1;
>      moo = Enum.opt2; // who would seriously want an error here???
> }
You are missing the point, nobody asked that. You are assigning it to  
auto, a runtime variable.
Which was asked was about modifying a constant, sort(a) means sort a  
in-place. So you cant do:
immutable a;
sort(a);
But with current design you can do:
enum a;
sort(a);
Which is to me, quite wrong.
    
    
More information about the Digitalmars-d-learn
mailing list