From: Michael Albinus <michael.albinus@gmx.de>
To: Daiki Ueno <ueno@gnu.org>
Cc: 20193@debbugs.gnu.org
Subject: bug#20193: 25.0.50; declarative type specification for D-Bus args
Date: Fri, 04 Sep 2015 09:29:44 +0200 [thread overview]
Message-ID: <87d1xyej6f.fsf@gmx.de> (raw)
In-Reply-To: <m3lhilu50q.fsf-ueno@gnu.org>
Daiki Ueno <ueno@gnu.org> writes:
Hi,
>> Well, dbus-test.el passes now, thanks. But there are still some cases
>> I'm not so happy with:
>>
>> plist-get
>> (dbus--test-create-message-with-args
>> '(:array)
>> '(:array :signature "u")
>> :type '(:array :uint32)
>> nil)
>> :signature)
>>
>> |- "asauau"
>>
>> I would expect "asauaub"
>
> Right, thanks for pointing that.
Thinking about, it seems to be OK. Ah :type keyword must always be
followed by two other arguments, and so it takes nil as the empty array
values, instead of a boolean false. Whether we allow to be sloppy, and
to add a missing nil as empty value list at the end of the arguments, is
something to be decided (and documented).
>> Maybe you could be a little bit more verbose about, and adapt the code?
>> When there is a :type argument, there must *always* be two additional
>> arguments?
>
> That makes sense.
As said above.
> Moreover, I personally prefer not to mix implicit and explicit typing.
> So, I am currently thinking to collect type specifiers for all
> arguments as a list and put it in front of the actual arguments, like
> this:
>
> (dbus-message-internal ...
> :timeout 100
> :type '((:array :string) (:array :uint32) (:array :uint32) :boolean)
> '("a") '(1) '(2) t)
>
> How does that sound?
I see two disadvantages:
- You couldn't use some functions any longer, like
(dbus-string-to-byte-array "Hello world") mixed with :type prefixed
arguments. Of course one could add a second function which returns
just the value list, but is it really helpful? It makes everything
more complex.
- You would loose the simplification of default types. A list is always
an array of strings, a string is a string, a natural number is a
uint32, and so on. You would be forced to write down the type
explicitely for every argument.
And we could simply use signatures then. Something like
(dbus-message-internal ...
:timeout 100
:type "asauaub"
'("a") '(1) '(2) t)
>> As you see, even I (who has tried to understand the new syntax) am a
>> little bit confused.
>
> Yes, I am realizing how helpful it is to write unit tests, to smoke out
> such pitfalls before landing the feature :-)
Yep. On my todo list is also to study the D-Bus tests at
<http://cgit.freedesktop.org/dbus/dbus-test/>. Maybe we could adapt
something from there.
> Regards,
Best regards, Michael.
next prev parent reply other threads:[~2015-09-04 7:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 3:31 bug#20193: 25.0.50; declarative type specification for D-Bus args Daiki Ueno
2015-03-26 11:34 ` Michael Albinus
2015-03-27 7:29 ` Daiki Ueno
2015-03-27 7:40 ` Michael Albinus
2015-08-27 9:23 ` Daiki Ueno
2015-08-28 7:31 ` Daiki Ueno
2015-08-28 8:22 ` Michael Albinus
2015-08-30 13:54 ` Michael Albinus
2015-09-02 7:24 ` Daiki Ueno
2015-09-02 14:06 ` Michael Albinus
2015-09-03 9:29 ` Daiki Ueno
2015-09-03 10:07 ` Michael Albinus
2015-09-04 2:33 ` Daiki Ueno
2015-09-04 7:29 ` Michael Albinus [this message]
2020-09-18 13:23 ` Lars Ingebrigtsen
2020-09-24 13:17 ` Michael Albinus
2015-09-03 16:08 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1xyej6f.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=20193@debbugs.gnu.org \
--cc=ueno@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.