[Kde-bindings] PerlQt constructor syntax

Jonathan Yu frequency at cpan.org
Wed May 27 16:36:23 UTC 2009


Conventionally, what you 'use' or 'require' the classes as is what you
would use them as. If you wish to use otherwise, then there is a
module called 'aliased' for this purpose; so you can say:

use Qt4;
use aliased 'Qt4' => 'Qt';

However
1. that module isn't core
2. that module will only map a single class/alias relationship, not
for the entire hierarchy. so just because you alias Qt4 -> Qt doesn't
mean Qt4::Button becomes Qt::Button, which is problematic for your
purposes.

On the other hand, the Qt namespace is currently registered to someone
else, so we can't use it unless we ask the PAUSE admins to allow us to
take it over, or we hear from Ashley Winters that the namespace can be
transferred to one of us.

What's the big deal with using Qt4 instead of Qt? pusling has
mentioned that it would be dissimilar from other bindings; however, in
practice I'm not sure if this is a huge problem, because the bindings
don't seem to be in wide use or development in their current state.

And I think making behaviour predictable for Perl users is more
important than making an interface similar to that of another
language. People programming in Perl adopt the Perl philosophy, I'd
think.

Sure, it's a bit different from other languages, but I don't think
it's a huge issue. If later on we decide that Qt:: is more appropriate
and the PAUSE admins let us take over that namespace, then we can move
our modules over without much work (it really just means changing the
XS stuff a bit, and is just a straight replace s/Qt4/Qt/ really)

On Wed, May 27, 2009 at 12:06 PM, Richard Dale <rdale at foton.es> wrote:
> On Wednesday 27 May 2009 03:26:14 pm Jonathan Yu wrote:
>> Richard:
>>
>> The reasoning behind naming it "Qt4" instead of just "Qt" is that
>> there is currently a module by that name, and some on the CPAN
>> module-authors mailing list have objected to the idea of taking over a
>> namespace like that.
>>
>> However, I can see what the PAUSE admins might think, and if they are
>> okay with us taking it over (no release was made by those authors
>> since 1997 on CPAN) then we can take it over and use it for ourselves.
>>
>> Primarily the issue people seem to have is backward compatibility,
>> though if we only ever need to provide support for the newest version
>> (except for critical security fixes) then this isn't an issue.
>>
>> I just think given past experiences we should have a plan in mind for
>> transitioning when Qt5 is out, however long off on the horizon that
>> may be.
>>
>> Cheers,
>>
>> Jonathan
>>
>> On Wed, May 27, 2009 at 5:29 AM, Richard Dale <rdale at foton.es> wrote:
>> > On Wednesday 27 May 2009 06:24:04 am Chris Burel wrote:
>> >> I originally sent this directly to who I believe are the authors of
>> >> PerlQt3, Ashley Winters and Germain Garand.  But I figured someone on
>> >> the kde-bindings list might have some input on this as well.
>> >>
>> >>
>> >> ---------- Forwarded message ----------
>> >> From: Chris Burel <chrisburel at gmail.com>
>> >> Date: Tue, May 26, 2009 at 2:36 PM
>> >> Subject: PerlQt constructor syntax
>> >>
>> >> There's a pretty lengthy discussion going on right now on perl's
>> >> module-writers list about the syntax of a new Qt4 module.  You can see
>> >> it here:
>> >> http://www.nntp.perl.org/group/perl.module-authors/2009/05/msg7591.html
>> >
>> > I don't have an opinion about the Perl constructor syntax one way or
>> > another, but to me the suggestion to name the classes like
>> > 'Qt4::PushButton' instead of Qt::PushButton is really ugly.
>> >
>> > It's great to see that the Qt4 version of PerlQt is picking up steam
>> > anyway. Do you think that anyone would be doing a KDE version? If so, it
>> > would be really nice to have the PerlQt and PerlKDE projects in the
>> > kdebindings svn, as then we would have 4 different Smoke based bindings
>> > there and it would be easier to coordinate the projects when we were
>> > improving the Smoke libs.
> I can see a reason for calling the xs extension that you use Qt4 instead of
> Qt, but the only point of renaming the classes would be if you want to use
> them in the same program, which nobody would. In perl if you say:
>
> use Qt4;
>
> Does that mean the classes have to begin with Qt4:: too? In QtRuby for Qt3 you
> do:
>
> require 'Qt' or require 'Qt3'
>
> and for Qt4:
>
> require 'Qt4'
>
> And the classes are called 'Qt::Widget' etc in both cases. I don't know enough
> about perl to see why it wouldn't be the same as Ruby here though.
>
> -- Richard
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
>



More information about the Kde-bindings mailing list