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

Jeroen Bollen jbinero at gmail.com
Thu Apr 23 11:28:36 PDT 2015


 > Using enum="interfacename.enumname" would probably work. The
> "interfacename." is optional if you are describing a method on the same
> interface. Another possibility is to just add interface="interfacename"
> to the argument along with enum="enumname".

The second possibility wouldn't work for bitfields that take enums from
different interfaces.

> An even more drastic approach would be to put all the values in the same
> namespace as interfaces, again renaming (or perhaps changing the values)
> as necessary. This would allow the programmer to write
> Widget.setAlignment(Left). It would also match how enums in C work.

Putting enums next to interfaces, instead of inside of them, to me, also
seems like the best option. I don't think it'll get any support however, as
it isn't backwards compatible.


On Thu, 23 Apr 2015 at 20:22 Bill Spitzak <spitzak at gmail.com> wrote:

> On 04/22/2015 11:49 PM, Pekka Paalanen wrote:
>
> > Allowing fully qualified names is another thing. Should we allow it? Is
> > it good practice? Is it useful? How would the fully qualitified names
> > look like?
> >
> > Even if it's not used for codegen, you need it for docgen if you want
> > to be able to reference other interfaces' enums. Many interfaces may
> > have same-named enums.
>
> Using enum="interfacename.enumname" would probably work. The
> "interfacename." is optional if you are describing a method on the same
> interface. Another possibility is to just add interface="interfacename"
> to the argument along with enum="enumname".
>
> Due to the name collisions of both enum names and enum values, most
> language binding will probably have to fully qualify any values. So you
> are likely to see widget.setAlignment(Widget.Align.Left) despite the
> redundant information.
>
> So a more drastic approach might be to make enums be in the same
> namespace as interfaces, renaming them as necessary to avoid collisions.
>
> An even more drastic approach would be to put all the values in the same
> namespace as interfaces, again renaming (or perhaps changing the values)
> as necessary. This would allow the programmer to write
> Widget.setAlignment(Left). It would also match how enums in C work.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150423/40be1767/attachment.html>


More information about the wayland-devel mailing list