Add 'float' wire data type?
I started thinking, what would it take to add a floating point data type to the argument types on the wire, and it seems doable for 32-bit float.
Let's say we add float support in libwayland version 1.k. It needs to be recognized in XML and emitted by scanner. It needs a new message signature character. It needs to be added in union wl_argument
. That's all?
The reason we cannot add any 64-bit types (easily) is that on 32-bit architectures, they would change the size of union wl_argument
.
The float type could be used in new protocol extensions. Adding it to existing protocol extensions would be discouraged, because it means that an extension that used to be buildable with wayland-scanner version < 1.k no longer builds. IOW, you cannot upgrade wayland-protocols without upgrading libwayland - although, is that something we want to explicitly support? For scanners for other languages, I think adding float
to an existing extension would be disruptive.
Obviously both server and client libwayland on the two sides of a Wayland connection must both support float
for it to work. Ensuring this is simple:
- If client uses an old libwayland, it cannot use an extension needing
float
, so never binds it. - If server uses an old libwayland, it will not advertise an extension needing
float
.
Furthermore, it doesn't matter if wayland-protocols gets new extensions using float
. All users of existing extensions can just keep on using old libwayland, since they never attempt to build new extensions needing float
.
A project that uses an extension that need float
will strictly require libwayland version >= 1.k. It cannot be built with an older version, and after building it cannot be run with an older version. But I think we already assume that you won't run with an older libwayland that what scanner you used for building.
A user for float
types could obviously be wayland-protocols!14, but we can also work around the lack of float with integers too.
What do you think of extending wire types like this?
Would you have use for float
on the wire?