[Kde-bindings] KDE/kdebindings/ruby/qtruby/src
Arno Rehn
arno at arnorehn.de
Sun Jul 25 22:54:48 UTC 2010
On Sunday 25 July 2010 22:48:02 Richard Dale wrote:
> On Sunday, July 25, 2010 09:33:31 pm Richard Dale wrote:
> > On Sunday, July 25, 2010 06:51:34 pm Arno Rehn wrote:
> > > On Sunday 25 July 2010 17:49:17 Sylvain Sauvage wrote:
> > > > Using a block might be less error-prone:
> > > > obj.constCalls do |cobj|
> > > >
> > > > cobj.doSomething
> > > >
> > > > end
> > >
> > > Ah, that looks nice. :)
> > >
> > > > (Although, I can’t see when const method calls could be really
> > > >
> > > > useful.)
> > >
> > > Some classes have method overloads that only differ by constness and
> > > where both have a different behaviour. An example is QDBusArgument,
> > > where the non- const versions of beginMap() and the like won't work on
> > > reply (i.e. read-only) values.
> >
> > My opinion is that overloading on const-ness is a really bad idea. If it
> > is so greate why can't do it in any language other than C++? So I prefer
> > just giving the methods different names. Resolving overloaded methods
> > based on whether the ruby variable are frozen is certainly like the C++
> > api, but to me that stuff was broken in the first place.
>
> Actually come to think of it, what I am objecting to in this change, is
> that you have removed the renamed methods - why can't we have overloading
> on frozen-ness as well as the existing methods with different names for
> the people who prefer to do it that way?
Yes, we could of course leave the different names for the methods. I actually
didn't see that they were differently named than the C++ methods - just
recognized that now.
In any case, due to 'freeze' freezing the whole object, not just a variable, I
would like to implement the overload resolution in the 'block-way', as Sylvain
suggested. That looks much cleaner to me.
--
Arno Rehn
arno at arnorehn.de
More information about the Kde-bindings
mailing list