It also makes it easier to inherit the constructor when subclassing the
module.  I would suggest that Perl modules should be done the Perl way,
rather than by importing ideas from other languages.

On Tue, May 26, 2009 at 11:22 AM, Jonathan Yu <jonathan.i...@gmail.com>wrote:

> Chris:
>
> I'm not sure if that's the most desirable behaviour, as it differs
> from the rest of the Perl world... Also, one useful thing is that if
> you want to create an object of something in Perl you could do:
>
> my $foo = Foo::Bar->new();
> my $bar = $foo->new();
>
> Which would create a $bar of the same type as $foo. You lose this by
> dropping the ->new part.
>
> I'm sure there's other very good reasons as to why those sorts of
> constructors are a bad idea.
>
> Jonathan
>
> On Tue, May 26, 2009 at 2:20 PM, Chris Burel <chrisbu...@gmail.com> wrote:
> > No,
> > Check out this document from Germain Garand wrote for PerlQt3:
> > http://web.mit.edu/perlqt_v3.009/www/index.html#anatomy_of_perlqt
> >
> > Syntax elements summary :
> >   1. All Qt classes are accessed through the prefix Qt::, which
> > replaces the initial Q of Qt classes. When browsing the Qt
> > documentation, you simply need to change the name of classes so that
> > QFoo reads Qt::Foo.
> >   2. An object is created by calling the constructor of the class. It
> > has the same name as the class itself.
> >      You don't need to say new Qt::Foo or Qt::Foo->new() as most Perl
> > programmers would have expected.
> >      Instead, you just say :
> >       my $object = Qt::<classname>(arg_1, ..., arg_n);
> >      If you don't need to pass any argument to the constructor, simply
> say :
> >       my $object = Qt::<classname>;
> >
> > On Tue, May 26, 2009 at 11:13 AM, Jonathan Yu <jonathan.i...@gmail.com>
> wrote:
> >> On Tue, May 26, 2009 at 2:08 PM, Chris Burel <chrisbu...@gmail.com>
> wrote:
> >>> It's currently neither.  Right now it looks like this:
> >>> use Qt;
> >>> my $app = Qt::Application(\...@argv);
> >>> my $hello = Qt::PushButton("Hello world!");
> >> I'm guessing you meant to say Qt::PushButton->new(...) :-)
> >>> $hello->show();
> >>> etc.
> >>> Which I realize is a problem.
> >>>
> >>> On Tue, May 26, 2009 at 11:00 AM, Jonathan Yu <jonathan.i...@gmail.com>
> wrote:
> >>>> Chris:
> >>>>
> >>>> Is it Qt4::Application or QApplication (as it was in Qt - ie version
> 1?)
> >>>>
> >>>> On Tue, May 26, 2009 at 1:59 PM, Chris Burel <chrisbu...@gmail.com>
> wrote:
> >>>>>> And really, what's wrong with Qt4::Application->new()?
> >>>>>
> >>>>> I've been modeling the Qt4 bindings off the Qt3 ones that Ashley and
> >>>>> Germain wrote.  And that's how it works in 3, so I kept it.
> >>>>>
> >>>>
> >>>
> >>
> >
>



-- 
Check out my LEGO blog at http://www.brickpile.com/
View my photos at http://flickr.com/photos/billward/
Follow me at http://twitter.com/williamward

Reply via email to