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 21:16:35 +0100
Wolter Hellmund wrote:
I don't see the benefit of these forms versus
struct Object {
int id;
float mass;
}
respectively
enum Process {
CONSTRUCT,
RUN,
DESTROY
}
or did you miss that these are available?
Oh, I totally missed that! I thought those were typedef kind of
declarations,
They are type definitions. I don't think this is what you meant.
struct MyStruct {
// ...
}
...
MyStruct my_struct = ...
I think you wanted to define a variable of an anonymous struct/enum type
(i.e. without naming the type). This is possible with C and C++ but not
with Vala, Java and C#.
Now, as to reply Frederick:
Well, I think that
foreach (MyEnum item in MyEnum.values) { ... }
would tell the system that item is an enum itself, and to look for
instances of it in MyEnum (thus to look for enums in an enum), am I
wrong? If not, then I'll consider filing a bug with the following
structure
foreach (MyEnum.Item item in MyEnum) { ... }
The type of an enum value (item) is the enum type itself:
enum MyEnum {
A,
B
}
...
MyEnum item = MyEnum.A;
Frederick: Also, good to have you back from Germany (someone tole me you
were away) I am going to show you how my SDL thing turned out later.
You can send me an email.
Best regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]