Enums, bitfields and wl_arrays

Nils Chr. Brause nilschrbrause at gmail.com
Wed Oct 14 08:40:18 PDT 2015


Hi,

On Wed, Oct 14, 2015 at 10:25 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Tue, 13 Oct 2015 20:27:58 +0100
> Auke Booij <auke at tulcod.com> wrote:
>
>> On 13 October 2015 at 16:19, Solerman Kaplon <solerman at gmail.com> wrote:
>> > Em 13-10-2015 11:35, Nils Chr. Brause escreveu:
>> >>
>> >> In C++ the order doesn't matter either, since each entry has a defined
>> >> value. I wonder why this is different in Java?
>
>> I really don't understand this discussion. Is the claim that the usage
>> of enums in java is problematic, because inserting a new value in an
>> existing enum might change the index of later values, thereby creating
>> an inconsistency?
>
> Yes, this is how I understood the problem from the irc discussion,
> indeed.
>
>> If so, all I can say that clearly the object you want to associate
>> with wayland-style enums is not whatever Java has invented for an
>> "enum". The values that are associated to names inside wayland enums
>> are very clear-defined, and if a language cannot safely couple names
>> back to values, then that is a language that does not understand the
>> concept of a variable. If this is a fundamental problem about Java
>> enums, you better find a way around it, but I don't see how this is in
>> any way a problem on the wayland side: there are enums, and enums
>> contain names, and those names have values.
>>
>> But if this is indeed the issue you are discussing, then this must
>> have already been a problem before the introduction of additional XML
>> attributes.
>>
>> Can we agree on the following? Until there is any firm specification
>> of open/closed enums, every enum should be considered open, and
>> although some legal values might be listed, others might not be, and
>> some might only be legal sometimes. New values may be added (but not
>> changed or removed) to protocol specifications without introducing any
>> compatibility issues.
>
> FWIW, I would be happy with that.

I would be happy with that, too. Also, this would bring us a step forward. :)

> Solerman, you forgot to reply-to-all. I added back the CCs.
>
>
> Thanks,
> pq

Cheers,
Nils


More information about the wayland-devel mailing list