Pascal lets you have a bitwise set from an enum using

Set of ENUMTYPE

Sam

-----Original Message-----
From: pancake <[email protected]>
Sent: 02 November 2009 18:42
To: Vala ML <[email protected]>
Subject: Re: [Vala] Minor features request (about structs and enums)


Michael 'Mickey' Lauer wrote:
>> Another feature that might be out of context, and I don't know if its
>> implemented but nor Google nor the people at the IRC channel have been
>> able to answer me, is enum iteration.
>>
>> foreach ((what type?) item in MyEnum) { ... }
>>     
>
> That's not possible indeed. It might be handy, please open a bug ticket.
>   
There's another bug report requesting a to_string () method for the 
enums that will be nice to have too

I was also thinking on implementing a enumflags keyword that acts like 
enum, but shift bits instead of increasing the value. so you can do:

enumflag Mode {
  READ
  WRITE
}

MyOpen (Mode.READ | Mode.WRITE);

What do you think about adding this new keyword? The thing will be good 
when using bitflags so you dont have to use an enum hardcoding the 
values in a manual way:

 enum Mode {
READ=1,
WRITE=2
..4, 8, 16, 32...
}


--pancake
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to