[Kde-perl] Re: perlQt question

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Aug 29 10:02:05 CEST 2003


On Thursday 28 August 2003 23:29, Germain Garand wrote:
> Le Jeudi 28 Août 2003 07:48, Richard Dale a écrit :
> >  findMethod() in Qt.xs doesn't distinguish between static and instance
> > methods - does it need to - is that the way to solve this problem?
>
> it could easily with the afore mentionned test,
> but we can't use that because the PerlQt syntax allows static/instance
> methods to be called the same way.
>
> e.g saying foo() in a Qt-derived package equates to either Package::foo()
> or this->foo()
>
> but you are right, now that I think about it, there are cases where we are
> sure we are looking for a static... so this could avoid some errors/abuse.
In QtRuby, bitBlt() looks like an instance method and the runtime would set up 
'this' correctly, but it would be ignored be the actual C++ call. So if we 
added to much checking, it might mess that up.

I think the munged method signature for QGlobalSpace operator should be 
'operator+#', not '+#' as that makes the runtime code less messy. Otherwise, 
you have to try both ways, and for both static and instance methods.

In kalyptusCxxToSmoke.pm, makeprotos() should look like this:

# Generate the prototypes for a method (one per arg with a default value)
sub makeprotos($$$) {
    my $classidx = shift;
    my $method = shift;
    my $protolist = shift;
    my $name = defined $method->{OriginalName} ? $method->{OriginalName} : 
$method->{astNodeName};
    iterproto($classidx, $method, $name, 0, $protolist);
}

So it uses the new OriginalName attribute with 'operator' in it.

-- Richard


More information about the Kde-perl mailing list