[Kde-bindings] Re: Smoke: On classes and objects

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Apr 4 10:54:21 UTC 2005


On Monday 04 April 2005 04:30, Ashley Winters wrote:
> --- Luca Fascione <lukes at wetafx.co.nz> wrote:
> >     /* ask Smoke to run the method on the given arguments,
> > interestingly
> > enough, arguments will be in an
> >        array of unions or some similar fairly dark magic... */
>
> Dark magic indeed. It's dark magic that works the same way for
> arguments, return-values, virtual functions, AND signals/slots. That
> was not an easy thing to arrange!
Yes, that was some pretty neat stuff. The way the marshallers recursively call 
the marshaller for the next arg in the arg array, and use the C++ stack took 
me a while to work out.

Have you had a look at how slots and signals are called in Qt 4 yet? The is an 
array, of type 'void **', which consists of a union passed to a function call 
qt_metacall(). The return type is the zeroth element. Spookily similar to the 
way Smoke arguments are passed. The only difference is that primitive types 
are held as pointers in the union, rather than as the values themselves. But 
that will probably make in easier to interface Smoke with Qt 4, as we won't 
have to copy the values in the array of Smoke args.

> You're going to feel limited if you don't allow creation of signals and
> slots or implementation of event handlers (which, in the OO languages,
> require subclassing).
You could use event filters to customise event handling rather than 
subclassing. I agree it would be difficult to do without some sort of 
slot/signal support though.

-- Richard



More information about the Kde-bindings mailing list