Spec clarification: can a signal and a method have the same name?
dbus at matthew.ath.cx
Wed May 23 01:59:01 PDT 2007
On Wed May 23 09:02, Simon McVittie wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Wed, 23 May 2007 at 06:37:35 +0200, Thiago Macieira wrote:
> > 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).
> OK, so Qt discourages and sometimes forbids signals and methods of the
> same name. Good to know. I think between that and dbus-python, if we
> clarify the spec to say you shouldn't have signals and methods of the
> same name, we'll be describing existing practice.
I was told when implementing the Java bindings that methods of the same
name but different interfaces should be implementable as different
methods on the same object; either with the same parameters or different
ones. I thus implemented it such that method overloading by input
signatures would work fine. I also implement signals as inner classes,
not methods, so there is no problem overloading them. I don't
particularly see a problem in supporting overloading by input
parameters; I'd be surprised if it were more work than supporting
overloading by interface (in my case the former made the latter easier).
I can also use an annotation to change the dbus name of a function, I
should implement that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070523/864f16bf/attachment.pgp
More information about the dbus