[PATCH wayland] Add "enum" attribute to "arg" elements

Pekka Paalanen ppaalanen at gmail.com
Mon Apr 27 00:05:27 PDT 2015


On Sat, 25 Apr 2015 14:11:32 +0000
Jeroen Bollen <jbinero at gmail.com> wrote:

> > I think that totally depends on how the interface is specified. This
> > applies only to one of the two ways an <enum> can grow.
> 
> What other way can it grow? It can only grow bigger. If the application
> isn't aware of new values added, it should output a warning or an error.

These:

On Wed, 22 Apr 2015 09:34:51 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> There are two ways to add values to an existing <enum>:
> 
> - Bumping the interface version, and ensuring the new values are used
>   only with the appropriate runtime interface version.
> 
> - From the first definition of an interface, specify how unknown values
>   should be handled. Otherwise users do not expect unknown values to
>   appear.

The latter case is where you do not want an automatic always-on warning
or error.


> On Fri, 24 Apr 2015 22:05 Bill Spitzak <spitzak at gmail.com> wrote:
> 
> > Since all the codegen packages that want to use this enum attribute have
> > not been written yet I don't think back-compatibility is an issue. They
> > are not using uint because they do not exist yet!

Except if you happen to have an old libwayland which you develop your
3rd party app against, for instance because you use a distribution that
does not include a more recent version yet.

Depending on the language, I suppose the breakage could go both ways?
Is there a language where an enum is not allowed to be implicitly
converted to a uint or int?


Thanks,
pq

> > The C codegen can continue to ignore the enum, or use it in a way that
> > does not break code that tries to pass an integer or the wrong enum.
> >
> > On 04/24/2015 12:07 AM, Pekka Paalanen wrote:
> >
> > > The purpose of docenum was purely for documentation. An API generator
> > > must ignore all docenum annotations. This was the backward-compatible
> > > addition.
> > >
> > > Any attribute that modifies the generated API in incompatible ways
> > > cannot be added after the interface has been released as stable. If
> > > your function argument was uint, and you change it to an enum in a
> > > strictly typed language, does it not have a good chance of breaking
> > > someone's build?
> >



More information about the wayland-devel mailing list