[PATCH 1/2] protocol: Allow versioned message arguments
Jason Ekstrand
jason at jlekstrand.net
Wed May 8 13:40:09 PDT 2013
On Wed, May 8, 2013 at 5:51 AM, <alexl at redhat.com> wrote:
> From: Alexander Larsson <alexl at redhat.com>
>
> This allows an event to be extended in a backwards compatible way (on
> the client side) by marking an argument with a since attribute.
> Any arguments with a since value later than then value of the message
> itself will be marked optional and the demarshaller will supply
> default values for these arguments.
>
I'm really nervous about extending arguments events/requests like this.
For one, there's no way in the wire protocol to specify how many arguments
are coming. Technically, you can get around this by simply using the
provided message size as you did below. However, what you have created
(from a protocol perspective) is an arbitrary list of optional arguments,
not versioned events. Also, it should be noted that defaults are a
non-issue because, once the client and server agree on a version, the extra
arguments will get disregarded on both sides.
>From another angle, this is going to be a real problem in other languages.
Yes, many other languages can have some form of function overriding.
However, they are not all as forgiving as C when it comes to not specifying
the correct number of arguments. In Java, for instance, this is going to
cause huge problems because once a function is in an interface, you can
only add functions (at which point, you have to implement them all). Also,
finding and using the correct version is going to be a run-time headache.
I don't think this is insurmountable, but it's certainly a pain.
In short, I think this is far too complex for what it achieves. In the
case of scaling factor stuff, you can just do it with a second event.
Thanks,
--Jason Ekstrand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130508/fc2b8848/attachment.html>
More information about the wayland-devel
mailing list