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
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to