Re: [Vala] Minor features request (about structs and enums)



Pascal lets you have a bitwise set from an enum using

Set of ENUMTYPE

Sam

-----Original Message-----
From: pancake <pancake youterm com>
Sent: 02 November 2009 18:42
To: Vala ML <vala-list gnome org>
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
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]