int32 vs uint32 issues with untyped language bindings
Andy Wingo
wingo at pobox.com
Mon Dec 27 13:10:10 PST 2004
On Mon, 27 Dec 2004, John (J5) Palmieri wrote:
> This all sounds so wrong for a weak typed language.
[...]
> Services should be required to register and export their signatures.
It's pretty clear that the call `foo(2)' is ambiguous wrt the type of
its argument. It could be anything from a boolean to an unsigned 64-bit
integer, or even a string in a language like PHP. Without signatures,
the programmer will have to make their intent explicit if the detected
type is not suitable.
Otherwise you will have to write a D-BUS interface for querying
signatures. It would needlessly complicate libdbus to add support for
type coercions, as well as potentially introducing another layer of
marshalling. Better to have the bindings call methods with the proper
types, conforming to the signatures. It's more precise, and "methods"
are really a bindings-level concept.
As I mentioned in my original email, a signature could be implemented as
a message without values. Would be a quick hack. But there are some
corner cases to get right: optional and default args for dicts, subtypes
for compound types (with no maximum recursion limit), and then there are
the methods for which it makes sense to accept arguments of different
types (e.g. a boolean false or a list, etc.). It would be a shame if
signatures could only represent a subset of the rich D-BUS type system.
Regards,
--
Andy Wingo
http://ambient.2y.net/wingo/
More information about the dbus
mailing list