On 30Nov2018 1133, Antoine Pitrou wrote:
On Fri, 30 Nov 2018 13:06:11 -0600
Neil Schemenauer <nas-pyt...@arctrix.com> wrote:
On 2018-11-29, Armin Rigo wrote:
...Also, although I'm discussing it here, I think the whole approach
would be better if done as a third-party extension for now, without
requiring changes to CPython---just use the existing C API to
implement the CPython version.

Hello Armin,

Thank you for providing your input on this subject.  I too like the
idea of an API "shim layer" as a separate project.

What do you think of writing the shim layer in C++?  I'm not a C++
programmer but my understanding is that modern C++ compilers are
much better than years ago.  Using C++ would allow us to provide a
higher level API with smaller runtime costs.

The main problem with exposing a C++ *API* is that all people
implementing that API suddenly must understand and implement the C++
*ABI* (with itself varies from platform to platform :-)).  That's
trivially easy if your implementation is itself written in C++, but not
if it's written in something else such as RPython, Java, Rust, etc.

C is really the lingua franca when exposing an interface that can be
understood, implemented and/or interfaced with from many different
languages.

So I'd turn the proposal on its head: you can implement the internals
of your interpreter or object layer in C++ (and indeed I think it
would be crazy to start writing a new Python VM in raw C), but you
should still expose a C-compatible API for third-party providers and
consumers.

I totally agree with Antoine here. C++ is great for internals, but not the public interfaces.

The one additional point I'd add is that there are other ABIs that C++ can use (such as xlang, Corba and COM), which can provide stability in ways the plain-old C++ ABI does not. So we wouldn't necessarily have to design a new C-based ABI for this, we could adopt an existing one that is already proven and already has supporting tools.

Cheers,
Steve


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to