Re: [Vala] enums



and why:

public enum Foo.Bar.Cow {
}
public class Foo.Bar {
}

does not compiles?

vala says:

error: syntax error, unexpected ., expecting {



On Thu, 8 Nov 2007 14:40:38 +0100
pancake <pancake youterm com> wrote:

It is not possible to define an enum inside a class definition?

public class Foo.Bar
{
        enum Constants {
                OK       = 0,
                ERROR    = 1,
                INTERNAL = 2
        }
       ...

valac says: 

  "error: syntax error, unexpected enum"

So, i think that definitions like:

public class Foo.Bar
{
   enum {
    OK = 0,
    ERR = 1,
    INT = 2
   }
}

should be converted into defines like:
  #define FOO_BAR_OK 0
  #define FOO_BAR_ERR 1
...

this probably breaks the syntax transformation..so..maybe we should
be able to define anonymous enums and named enums like C does, but for vala:

 - Foo.Bar.OK
or
 - Foo.Bar.OK
 

Btw...it is possible to define the type for an enum? or are they always integers?

thanks

  --pancake
_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala



  --pancake



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