> 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 <spit...@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.
>
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to