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.


There's some truth to the issues you raise, but there are a lot of nasty details
behind the scenes. Do you have some more concrete details for what you're
proposing? In particular, Cython mangles all of its variable and function names.
How do you want to work around that? How should exception forwarding and
throwing work?

You're right that it's unrealistic to ever expect Cython to support a full set of C++
like features, but, at the same time, often C++ libraries use many of the fancier
features to create higher level interfaces that, conceptually, have a much simpler
interface than we give them credit for. In many cases, the metaprogramming,
though a part of the "interface" in C++ really is more of an implementation detail
and is hidden from Cython. I wouldn't expect Cython to ever properly implement
things like SFINAE, expression SFINAE, or even perfect forwarding, but it 
often still makes sense for it to interact with interfaces that are written using
these features. Given that not all features actually need to be implemented in
Cython, the question becomes more about what is good enough to support most
interfaces nicely.

Regardless of exactly which C++ features need to be supported right now, here are
a few ways you can do things like this right now.
- You can define inline functions, macros, or templates in separate headers.
  Though this does introduce additional files, it routes things through fairly standard
  code paths and makes things pretty reasonable. This is what I prefer to do when
  need more C++ features that Cython provides.
- Tell Cython how the interface you're using is used, not how it is constructed. C
  style variadic function calls are especially good for this since they essentially
  bypass all type checking on a given function's arguments.  
- You can currently exploit user-specified C names of functions and variables to
  inject expressions into compiled code. This is an awful hack that happens to
  combine supported features in a useful way. You can inject a wide variety of
  expressions into the generated C++ code, but it's painful enough that doing
  something else is almost always preferable. It totally kills readability.

All that said, I really think that there are more useful and concrete things to work on
at the moment. There's plenty of work to do to make Cython up to scratch for
wrapping arbitrary (reasonably well designed) C++ interfaces. Inlining C++ code
into Cython seems like a nice idea up front, but in practice it's less clear what that
would mean and how exactly all the accompanying semantics would work.

Thanks for raising a lot of these issues though. Interfacing between Python and
modern C++ is definitely worth the discussion.

Best,

Ian Henriksen