On Thursday 03 February 2011 16:29:59 Anderson Lizardo wrote: > On Thu, Feb 3, 2011 at 12:13 PM, Hugo Parente Lima > > <hugo.l...@openbossa.org> wrote: > > On Thursday 03 February 2011 12:54:50 Sylvain Meunier wrote: > >> Hello, > >> > >> What is the usual way for binding method templates ? > > > > There's no simple way, sometimes it's possible some times not because we > > can't instantiate those template methods at runtime. So you need to > > analyze the semantics of the method and write some kind of code > > injection to do the hard task of connect the world of compile time stuff > > (C++ templates) to the world of run time stuff (Python). > > > > As an example you could see our implementation of qmlRegisterType<T>[1] > > or QObject::findChildren to have an idea. > > I wonder if this could be made automatic by extending apiextractor to > parse templates as well? or does it already parse templates and one > could extend the generator? > > Of course, it would not work in 100% cases, but it would be nice if we > could have some typesystem support for simple templates which would > not require manual inject code.
It isn't a parser problem, it's a "can't generate C++ code at runtime problem" :-P C++ knows everything at compile time, but when we are generating the bindings we don't know what types the python user will use to call Foo::bar<T> method. For some cases we can do workarounds like creating a C++ type and using it in the function call every time the python user calls the bar function with a Python type, for other cases it is a bit harder, btw you can take as hard example the qRegisterMetaType function that isn't binded yet in PySide because it requires a non trivial workaround. > My two BRL cents :) -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list PySide@lists.openbossa.org http://lists.openbossa.org/listinfo/pyside