On Mon, Nov 5, 2012 at 7:00 AM, Stefan Behnel <stefan...@behnel.de> wrote:
> mark florisson, 05.11.2012 12:02:
>> On 4 November 2012 22:32, Olivier Parcollet wrote:
>>> I would like to write some automatic C++/python conversionsfor the
>>> classes of my project
>>> in addition to std::vector and others std:: objects.
>>>
>>> Conversions for std:: objects are written in
>>> Cython/Utility/CppConvert.pyx, i.e. an internal cython file.
>>>
>>> The question is then simply to load another CppConvert.pyx file that
>>> would be project dependent.
>>> Is there already a way to do it ?
>>> or a plan to do provide such user defined conversions ?
>>>
>>> I made a simple patch to load also another CppConvert.pyx from the
>>> current directory,
>>> which works for my code, but I would welcome a more general solution...
>>>
>>
>> Great. Ideally, Cython would be plugable, allowing one to use a
>> documented API and to insert new visitors at certain points in the
>> pipeline, allowing custom transformations and utilities
>
> I wouldn't call that "ideal". In case we want to support this kind of
> extensions, it should happen at the source code level, not hook into the
> compiler pipeline as part of the build process.
>
> IMHO, the right way to provide custom type conversions is by declaring
> them, e.g. as part of a C++ class declaration.
>
> BTW, I'm sure this has been discussed more than once on this list.

Yep. It's a question of complicating the language and coming up with
the right syntax. For the stl containers, we decided to implement them
directly and cross the generic bridge at some later point. Certainly
worth writing up a proposal as a CEP
http://wiki.cython.org/enhancements .

- Robert
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to