GNU bug report logs - #20193
25.0.50; declarative type specification for D-Bus args

Previous Next

Package: emacs;

Reported by: Daiki Ueno <ueno <at> gnu.org>

Date: Wed, 25 Mar 2015 03:32:01 UTC

Severity: wishlist

Found in version 25.0.50

Full log


Message #8 received at 20193 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Daiki Ueno <ueno <at> gnu.org>
Cc: 20193 <at> debbugs.gnu.org
Subject: Re: bug#20193: 25.0.50; declarative type specification for D-Bus args
Date: Thu, 26 Mar 2015 12:34:12 +0100
Daiki Ueno <ueno <at> gnu.org> writes:

> Hello Michael,

Hi,

> Suppose a simple D-Bus signature "a{si}".  Since dbusbind treats positive
> integers as uint32, one would need to write:
>
> So I would like to propose an alternative syntax, similar to the `:type'
> keyword of `defcustom', like this:
>
>   (dbus-call-method :session
>                     "org.example.Foo"
>                     "/org/example/Foo"
>                     "org.example.Foo"
>                     "Test"
>                     '(:type (:array (:dict-entry :string :int32)))
>                     '(("a" . 1) ("b" . 2)))

In the early design phase of dbus.el I have played with explicit
signatures for the arguments, like

  (dbus-call-method :session
                    "org.example.Foo"
                    "/org/example/Foo"
                    "org.example.Foo"
                    "Test"
                    :signature "a{si}"
                    '(("a" 1) ("b" 2)))

which is similar to your proposal, with other means. I haven't
implemented it, because I found it to strict for Lisp developers to
think in D-Bus signatures. It has only survived for marking the type of
an empty array.

Your proposal is closer to the developers, so it has charm. There is
also a minor difference how dict entries are expressed, but that could
be agreed. So I'm open to this, as an *alternative* option to the
existing spec. We don't want to break existing code.

> Would this kind of change be considered?  As a proof-of-concept, I'm
> attaching a small Elisp snippet that augments the argument value with
> the given type information (though I guess it should be implemented in
> the C level, to avoid duplication of signature computation code).

IIRC, this was another reason that I haven't followed the :signature
approach - it was harder to implement in dbusbind.c. But this is years
ago, maybe my memories are wrong.

Yes, it shall be implemented in dbusbind.c - would you like to try it?

Btw, one of your examples is wrong (or at least misleading). An empty
array must contain exactly one element of type signature. The case you
have shown here indicates, that '(:array :signature "sig") is an array
with exact one elemt, a signature. Although possible in D-Bus, this is
not possible in dbus.el (maybe a design flaw?). Your example could be
therefore changed to

;; (dbus--annotate-arg '(:struct :object-path (:array (:dict-entry string :int32)) :string)
;;                     '("path" nil "password"))
;; ;=> ((:struct :object-path "path" (:array :signature "{si}") :string "password"))

This would require additional mapping of the type symbols to signature
strings - something what exist in dbusbind.c already.

> Regards,

Best regards, Michael.




This bug report was last modified 4 years and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.