[Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

Jason Newton nevion at gmail.com
Sat Aug 20 17:46:19 EDT 2016

On Sat, Aug 20, 2016 at 1:19 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:

> Especially with respect to C++, we've always tried to make things safe and
> helpful that Cython can support directly, and to make things possible that
> are too complex to handle safely. But I agree with Robert that allowing
> arbitrary C++ code snippets inside of Cython code is not a good idea.

Why is allowing arbitrary code inside not a good idea?  We're not talking
something necessarily like eval here and the reputation it got, we're
talking C/C++ glue and for the scale of Cython's development effort, proper
C++ support is insurmountable simply because the language is that hard to
work with on the compiler side.  You can't just go and take something that
is readily in the process of evolving (as newer standards actively come
out), that very slowly achieves full compiler support in it's own domain,
and pretend/aspire you can work like that though high level constructs in
your language - this project and none before it have not accomplished
anywhere near that and simply don't have the man-years/decades to
contribute.  I truly think it is irresponsible to think a) we should do
nothing or b) delude  ourselfs that we can make high level language level
features to get around this.


> If there are code constructs that we can add to improve the C++ integration
> then we should do that, even if it means that Cython would (initially?) not
> be able to validate that code. But we should otherwise keep the language
> such that it allows us to get back to a state where Cython can validate and
> understand what it sees.

I'm not going to argue against you making C++ developer life easier but I
have no idea how you could wrangle the beast in another way than letting
the C++ compiler handle things.   I don't think it's important that Cython
compiler can validate / understand everything it sees - I'm not saying that
by default, but just like the various flags you can use with cpdef,
strategic sacrifices are acceptable for consenting adults. Otherwise you
are still saying you will limit capability, which many can't agree with and
avoid like the plague.

Remember - cython is "the way" that comes up for how to glue C/C++ into
python these days, not just the program in cish python frontend for speed.

> Stefan
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160820/990d9c07/attachment.html>

More information about the cython-devel mailing list