Re: [Vala] Minor features request (about structs and enums)
- From: Frederik <scumm_fredo gmx net>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Minor features request (about structs and enums)
- Date: Mon, 02 Nov 2009 19:48:33 +0100
Wolter Hellmund wrote:
I think Vala is missing some minor features related to type declarations
(such as structs and enums) that both C and C++ have and are really
useful.
For example, if you are to declare a single struct in C or C++, you can
just do:
-----------
struct {
int id;
float mass;
} Object;
------------
In Vala, you cannot (as far as I know by experimentation.
Such is the example with the enum:
------------
enum {
CONSTRUCT
RUN
DESTROY
} Process;
------------
Again, Vala does not support this kind of declaration.
C# and Java don't either. I personally think defining each type separately
and giving it a name is more readable, even if it's used only once.
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) { ... }
foreach (MyEnum item in MyEnum.values) { ... }
would probably make sense. 'values' would have to be a built-in member, like
'length' for arrays.
Best regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]