[Kde-bindings] KSharedConfig multiple matches
Richard Dale
rdale at foton.es
Mon Feb 1 17:42:00 UTC 2010
On Monday 01 February 2010 04:47:11 pm Stefano Crocco wrote:
> On Monday 01 February 2010, Stefano Crocco wrote:
> > |On Monday 01 February 2010, Richard Dale wrote:
> > |> |Thanks for the patch - i'm sorry I've taken so long to have a look at
> > |> |this. In fact I was about to fix it, when I discovered there was
> > |> |already a 'isConstMethod()' that I was about to add. It seems Arno
> > |> | had already applied your patch.
> > |> |
> > |> |I was going to give a const method a score of 1, rather than have
> > |> | this special case test at the end of the matching:
> > |> |
> > |> |if !isConstMethod(id) and isConstMethod(chosen)
> > |> |
> > |> | chosen = id
> > |> |
> > |> |elsif isConstMethod(id) == isConstMethod(chosen)
> > |> |puts "multiple methods matching, this is an error" if debug_level
> > |> |
> > |> |>=DebugLevel::Minimal
> > |> |
> > |> | chosen = nil
> > |> |
> > |> |end
> > |> |
> > |> |But if it works I think we should leave it as per your patch.
> > |> |
> > |> |The overloading on const/non-const arguments issue is something I
> > |> | don't even know was a problem, but I think your solution of giving
> > |> | a score of 1 for const args is correct.
> > |
> > |As far as I can tell, it works. Unfortunately, I only met this issue for
> > |KDE::SharedConfig.group and KDE::ConfigGroup.new, so I don't know
> > | whether it would fail in other cases.
> > |
> > |Stefano
>
> I spoke too soon. I just found out a stupid error in that patch. The
> problem is that in the elsif branch, it assumes that chosen is not nil.
> However, it can happen that chosen is nil. I just found out by chance that
> this happens for Qt::Locale#to_string when passed a float argument. It
> seems that replacing line 2714 of qtruby4.rb with
>
> elsif chosen and current_match == best_match
>
> solves the issue.
OK, I've changed the code so that it just sets current_match to either 0 or 1
at the start of the method matching depending on whether the method is const
or not as that seems a bit simpler.
-- Richard
More information about the Kde-bindings
mailing list