[Kde-bindings] ruby bindings

Ashley Winters jahqueel at yahoo.com
Wed Jul 2 23:32:08 UTC 2003


--- Richard Dale <Richard_Dale at tipitina.demon.co.uk> wrote:

> > Lastly I have almost completey worked out a library for bridgeing
> > slignal/slots from C++ into code that provides introspection
> (pretty much
> > very language out there today)  It takes 1 half written in C++ and
> the
> > other half is written in the native language.  Not as automagical
> as I had
> > hoped but its showing promise.
> I don't like scripting languages to have to use C++ type signatures
> for 
> connecting signals and slots, I think they should be hidden from a 
> prototyping language like perl or ruby.
> 
> This:
> Qt::Object::connect(fontComboBox, SIGNAL "activated(string)",
> textEdit, SLOT 
> "setFocus()");
> 
> Rather than this:
> Qt::Object::connect(fontComboBox, SIGNAL "activated(const QString&)",
> 
> textEdit, SLOT "setFocus()");
> 
> ..or maybe not. I assume PerlQt users haven't complained so perhaps
> it doesn't 
> matter.

I complain. Oh, how I complain. WHY didn't QSA provide a
language-neutral signal/slot naming format for us to steal? *cry*

I cannot begin to describe how disappointed I am in QSA as a language
binding. It's not. Of course, it never claimed to be. I only hoped.

If I had my preference, signal/slot syntax in PerlQt would be
different. I've contemplated this:

fontComboBox CONNECT -activated => textEdit SLOT -setFocus;

Sadly, it wouldn't work for scalars, only for declared attribute
objects. Perhaps I'll add it anyways, just for kicks.

The main problem would be the damned overloaded signal/slot names, and
having to guess which prototype to use. How often would we need to
handle it? Would it be better to come up with an inter-language/class
decoration? -resizeInt vs. -resizeRect or something?.

I wouldn't suggest slot renaming. It's unfortunate.

As far as guessing, here's where I would draw the line:

The signal has prototypes, and the slot has prototypes. Find the
largest number of slot arguments that has a corresponding signal with
an identical prototype, then select the signal with the shortest number
of arguments among those that match. If this system ends up with
multiple applicable matches, like signal(int) => slot(int) or
signal(double) => slot(double), it's ambiguous. You may either rand(),
use a precedence order, or raise an error.

Ashley Winters

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


More information about the Kde-bindings mailing list