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

Bill Spitzak spitzak at gmail.com
Thu Apr 23 11:21:02 PDT 2015

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.

More information about the wayland-devel mailing list