Le Mercredi 12 Novembre 2003 04:25, Richard Dale a écrit :
> On Monday 10 November 2003 15:47, Germain Garand wrote:
> > > The Smoke library used be both perl and ruby, finds methods by starting
> > > at a 'best guess' of setText# in this case, to mean a setText() method
> > > passed an object of some sort. Instead it should guess 'setText$' if a
> > > string was expected, but I haven't worked out how to do that yet, it's
> > > harder than it sounds :(..
> >
> > Actually, PerlQt can use undef arguments because whenever it encounters
> > one, it builds parallel requests
> > - e.g foo(undef, 3) will build "foo$$", "foo#$" and "foo?$"
> > That's the meaning of the map {} stuff in do_autoload.
>
> Ah.. thanks for that! I've always wondered what that code did, now I
> understand the map function I can see that's really neat stuff. I've
> translated it directly into ruby, and nil string args work fine now.
>
I was stunned when I first saw those ten lines.
Makes me feel like a ruthless butcher every time I poke around :-)
> When I ran my test puic .ui generated program with debug on, I got this
> message:
>
> Ambiguous method call for :
> QKeySequence::QKeySequence(undef)
> Candidates are:
> QKeySequence* QKeySequence::QKeySequence(int)
> QKeySequence* QKeySequence::QKeySequence(const QString&)
>
> The ruby version of the undef arg test in argmatch() looks like this:
[...]
> It gives a higher priority or score to string arg types, so it would pick
[...]
> Also in the test for classes, I've given a higher priority for an exact
> match,
Good! We have very close selection mechanisms then.
|