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

Pekka Paalanen ppaalanen at gmail.com
Mon Apr 27 06:13:51 PDT 2015

On Mon, 27 Apr 2015 15:49:27 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> In the end, all I care is about the definition of the new attributes
> related to enum. If you really want to write a generator that can break
> the build of other people, you can.
> I would just want the definition of the attribute be such, that
> following it literally, nothing can break even if the attribute gets
> added much later than the interface it is used in. Either this, or
> adding/removing the attribute is allowed to break the generated API,
> which means we cannot add it retroactively to stable interfaces. That
> is the difference between documentation-only and not.

How about we just define a new attribute for <arg> that points to an
<enum> for documentary purposes, and warns if the type is not int/uint
or uint for bitfields; and add an attribute to <enum> to say it's a
bitfield instead, without any further enforced restrictions.

Then, if you want to generate API bindings that have extra
restrictions not warranted by the above, you can. You also get to keep
all the pieces if it breaks someone.

This would be the "documentation-only, but we can't stop you from
abusing it" solution.

The chances are that it would work just fine for 99% of your
favourite language's users. We can add the attributes retroactively,
and you can write software that requires the version of libwayland or
whatever that has these attributes in the XML.

The point is, it will be clear on what protocol writers can and cannot
do, and with maximum benefits.


More information about the wayland-devel mailing list