[Kde-bindings] const_missing method in ruby 1.8

Alexander Kellett lypanov at kde.org
Tue Aug 5 09:37:50 UTC 2003


On Tue, Aug 05, 2003 at 10:39:58AM +0100, Richard Dale wrote:
> > but, quick question nevertheless, would this
> > be modifications to Qt.rb or Qt.cpp?, i didn't
> > really understand the do_method_missing. i'll
> > try to read more code tonight. haven't read
> > all that much up till now.
> 
> It probably won't involve a change to do_method_missing in Qt.rb. It might 
> just be a matter of adding this in Qt.cpp, Init_Qt():

realized this shortly after sending the email and reading 
the code ;-) hadn't really looked at Qt.cpp at all yet.

>     rb_define_singleton_method(qt_base_class, "const_missing", (VALUE (*) 
> (...)) class_method_missing, -1);
>     rb_define_singleton_method(qt_module, "const_missing", (VALUE (*) (...)) 
> module_method_missing, -1);
>     rb_define_method(qt_base_class, "const_missing", (VALUE (*) (...)) 
> method_missing, -1);
> 
> Just add three new overrides for 'const_missing' which point to the same C 
> functions as the three 'method_missing' equivalents.

after readingthe code i tried all three of them seperately but 
not yet together. i'll give this a try now :)

> > so. the error
> >    builder.rb:17: [BUG] Cannot handle 'QCanvasItemList' as return-type of
> > QCanvas::collisions is really quite understandable.
> > though a nice error message would be nicer, which
> > brings me to another tangent.
> I think it would be a good idea to try the same thing in PerlQt, and see how 
> its error messages come out.

yes. i shall try with PerlQt-3.006 tonight. good idea.
i'll try to fill in some more of the error handling code
in Qt.cpp tonight in fact. it makes development quite
slow as it requires heavy reading of Qt docs just to find
out exactly what you did to make it go "[BUG]" ;-)

> > i'm guessing that some sort of generic base QValueList[Iterator]
> > object handler needs to be created?, or, is there a minor
> > bug in the bindings generation that stops this case maybe?
> >
> > i'm guessing its also not possible to use it as a parameter
> > therefore, which is pretty limiting as a large number of
> > functions use QPtrLists's, QValueList's etc.
>
> We'd need specific marshallers for each concrete instance of a QValueList I 
> think, in handlers.cpp. Here are the existing marshallers, so there are some 
> QValueList ones - we would need some more like that for QCanvasItemList etc.

this seems quite evil especially considering that imo
kalyptus could just be creating bindings for the actual
iterator objects. any reason against that? it seems like
a far better way that the current system of writing a 
handler for each commonly used type. or, maybe just a 
big set of macros to automate the type handling would be
enough rather than a smoke extension.

> > okay, back to the tangent. error handling currently code
> > such as canvas.setBrush(Qt::Color.new(r,g,b)) will simply
> > bomb out with little information as brush is expecting
> > a QBrush, not a QColor. as i'm guessing
> I think that could be improved - I haven't put much thought into better error 
> handling really - sadly the project came together with excessive speed :)

hehe ;-)
i'll put some thought into this, need to read the
perlqt code first though to get a grasp of exactly
what is missing. and i still really want to tackle
that evil regexp, and need test code to even begin :)

> > this pqtsh thing looks really nice. i'd like to
> > do something like this in ruby. i wonder if it
> > uses anything more than perl's introspection or
> > if PerlQt provides a sort of smoke perl binding?
> I hadn't heard of that

http://perlqt.sourceforge.net/dist/current/doc/images/pqtsh.png

> > p.s: if anyone has a PerlQt checkout, i really
> >      could use it, as i can't get anything
> >      whatsoever from sourceforge cvs  :(
> I just downloaded the PerlQt-3.006.tar.gz tarball, I didn't try to get 
> anything from the cvs.

aah. ashley said go for cvs, so, i'll give the 
tarball a shot instead now tonight ;-)

cheers!
Alex

p.s: maybe this will be interesting to you:
   http://whytheluckystiff.net/articles/2003/08/04/rubyOneEightOh


More information about the Kde-bindings mailing list