Enums, bitfields and wl_arrays
Auke Booij
auke at tulcod.com
Fri Oct 2 04:37:51 PDT 2015
Thanks for bringing this up again, Bryce.
On 1 October 2015 at 18:59, Jasper St. Pierre <jstpierre at mecheye.net> wrote:
> We have a few constraints. First off, not all enums are closed. Some
> are intentionally open, like xdg_shell.state. So we definitely need a
> distinction between a closed enum and an open enum. I'm not familiar
> enough with Rust to be able to apply something to that.
Yes, this is a point that was raised before (IIRC especially by
Pekka). This is why, in my patches, I document these attributes as
being for documentation purposes only, although obviously they might
be abused by some bindings. Yes, a closed enum could be encoded into
more strongly typed languages (in which case a compilable program only
specifies what it does on the "legal" values, and simply crashes or
errors out on the unknown ones - this would be justified by the broken
promise that the enum was closed). But I agree that this is a
guarantee you cannot always make, and will open up a debate far bigger
than the actual problems these patches set out to solve.
> There's also a compatibility issue that has been brought up, but I
> never understood that one. Somebody else would be able to talk about
> that better.
Can you quote what you are referring to here?
More information about the wayland-devel
mailing list