[Kde-perl] Signals & Slots
Ashley Winters
jahqueel at yahoo.com
Thu Jun 5 21:03:28 CEST 2003
--- Germain Garand <germain at ebooksfrance.org> wrote:
> Le Vendredi 06 Juin 2003 02:02, Ashley Winters a écrit :
>
> > I like the SIGNAL( int ) syntax, but I'll probably want to have a
> named
> > signal interface anyways, since Perl doesn't support overloading on
> > parameters... SLOT( resize(int, int) ) vs. SLOT( resize(const QSize
> &)
> > ). However, I much prefer SLOT( const QSize & ). :)
>
> mmh, I'm afraid I don't understand what you mean.
>
> In the current implementation,
> sub foo : SLOT( int )
> declares the slot
> 'foo(int)'
Ehh, I've been thinking about the reverse operation lately, so that's
probably what led me to persist in the idea.
In order to 'disambiguate' functions I was going to propose:
sub thingyUnsignedInt : alias( thingy(unsigned int) );
sub thingyLong : alias( thingy(long) );
sub operatorLShiftInt : alias( operator << (QDataStream&, int) );
That lead me to the non-Perl-like proposal of optionally allowing the
overloading of "visible" names of signals/slots (for better or worse).
As for the warning which mandates the somewhat loud SIGNAL/SLOT
syntax...
It turns out that the reserved word warning comes from "use warnings
qw(reserved)". Given the syntax-warping nature of PerlQt, I wouldn't
hesitate on mandating "no warnings qw(reserved)" for any modules which
inherit from a Qt class (and by mandating, I mean courteously switching
it on for them without asking). :)
So, I'm kinda in favor of sub foo : signal(); over sub foo : SIGNAL();
with an automatic no warnings qw(reserved) in PerlQt classes.
Ashley Winters
>
> So what's the benefit of supplying a name?
>
> Having the syntactical ability to declare:
>
> sub bar : SLOT( foo( int ) ) {}
> sub boz : SLOT( foo( int, const QSize &) ) {}
>
> looks rather more confusing to me than
>
> sub foo : SLOT( int ) {}
> sub bar : SLOT( int, const QSize &) ) {}
>
> G.
> _______________________________________________
> Kde-perl mailing list
> Kde-perl at mail.kde.org
> http://mail.kde.org/mailman/listinfo/kde-perl
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
More information about the Kde-perl
mailing list