Spec clarification: can a signal and a method have the same name?

Thiago Macieira thiago at kde.org
Tue May 22 21:37:35 PDT 2007


Simon McVittie wrote:
>A question for the specification gurus:
>
>Signals and methods are both identified by a pair (interface, member)
>where the member part is in the same format for both.
>
>Are bindings expected to support a signal and a method in the same
>interface having the same name?

In Qt, signals and methods are member functions in a C++ class, so they 
can only exist at the same time if they are overloads of one another 
(different parameters).

However, overloads of same name are considered not portable on D-Bus, so, 
no, you're not allowed to use the same name for both signals and methods 
portably.

>(The OLPC's DataStore has methods called things like 'delete', which
>emit signals also called things like 'delete'. I realise this is
>an unconventional naming scheme - not my choice - but I don't know
>whether this is something I should be supporting or forbidding in
> dbus-python. At the moment dbus-python doesn't support this without
> some awkwardness, or possibly at all.)

"delete" is also a reserved word in C++. An interface with such a name 
will fail to compile.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070523/dbab15da/attachment.pgp 


More information about the dbus mailing list