[Kde-bindings] PerlQt constructor syntax

Jonathan Yu frequency at cpan.org
Mon Jun 1 19:37:40 UTC 2009


Well, based on my proposal, you'd only ever need to:

use Qt4;
my $qt = Qt4->new;
my $button = $qt->Button->new;

OR

my $button = $qt->Button;

So, you'd only have "Qt4" appearing twice, which is much more
manageable than having everything prefixed with Qt4 (which was the
issue in the first place).

As well, the idea is more compatible with the Perl philosophy; since
if you 'use' something, that should be the exact thing that is
expected to appear in your namespace, nothing else. How weird would it
be if you did:

use Module;

and then had to do SomeThing->new;

to instantiate it?

That's just odd, and in most languages that I know of, that's
considered really weird.

Cheers,

Jonathan

On Mon, Jun 1, 2009 at 3:10 PM, Eric Wilhelm <enobacon at gmail.com> wrote:
> # from Jonathan Yu
> # on Monday 01 June 2009 11:28:
>
>>I strongly feel that the Qt4 namespace is most appropriate for this
>>module. On the other hand, how do we provide a simple upgrade path?
>
> I suggest:
>
>  use Qt4 as => 'Qt';
>
> This calls "Qt4->import(as => 'Qt');", which would then need to install
> all of the constructor functions in the Qt:: namespace.
>
> --Eric
> --
> But as soon as you hear the Doppler shift dropping in pitch, you know
> that they're probably going to miss your house, because if they were on
> a collision course with your house, the pitch would stay the same until
> impact. As I said, that one's subtle.
> --Larry Wall
> ---------------------------------------------------
>    http://scratchcomputing.com
> ---------------------------------------------------
>



More information about the Kde-bindings mailing list