Hi Forest,

You can do:

    const fooStates :List(foo) = [unset, bar, bars];

The parser knows that you're parsing values of type "foo", so it doesn't
need the "foo." context.

-Kenton

On Tue, Oct 2, 2018 at 4:28 PM <[email protected]> wrote:

> Hi.
>
> I am trying to make a list of constant enumeration values in a capn proto
> schema file.
>
> enum foo{
>         unset            @0;
>         bar         @1;
>         bars        @2;
> }
>
>
> const fooStates :List(foo) = [foo.unset, foo.bar, foo.bars];
>
>
> However, the report of the parser is that unset is not a member of foo.  I 
> tried foo.Unset, foo.UNSET, foo::unset, foo::UNSET and nothing worked.  
> foo.unset and foo.UNSET also failed due to unset (UNSET) not being a member 
> of foo and foo::XXX fails due to a parse error.
>
>
> I can workaround the language limitation by making a list of ints but that is 
> prone to error in the face of changes to the foo enumeration.
>
>
> const fooStates :List(UInt16) = [1, 2, 3];
>
>
> Is there a way to make a list of enum values as a constant in a captn proto 
> schema file?
>
>
> Thanks in advance!
>
>
> Forest
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to