[pypy-dev] okay to rename cppyy -> _cppyy

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Fri Jul 21 03:46:06 EDT 2017


Armin,

> Ouch, I suppose :-)  Explicit C++ mangling.  The alternative would be
> to use ffi.set_source() instead of ffi.dlopen(), and use a C++
> compiler again to produce the cffi binding.

sure, but the mangled name saves a redirection and has less code to generate,
was my point. Besides, who looks at generated code. :) Have you seen what
comes out of the PyPy translator ...

> But as you mentioned there are additional issues, e.g. with instantiation
> of templates.

And all other dynamic behaviors, incl. deriving Python classes from C++
ones for use in C++-land. (Is currently disabled, as I never implemented
that for the PyPy side, only CPython (it uses the Python C-API).) Or
general patch-ups (e.g. byte* <-> char*). Or auto-downcasting (favorite).
Or class unique-ness. Or adding user-defined classes interactively.

As said, in the end it'd be just SWIG but with a better parser (and no
Python versioning issues, or new language to learn).

I'd like to see the performance of a more complex case, though. E.g. when
doing class matches using Python reflection such as isinstance. I've always
had a hard time getting these things fast in RPython, and PyPy may have an
easier time with proper Python code (another reason to reject C++ wrappers
and live with mangled names).

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list