Jeroen Demeyer schrieb am 01.08.2018 um 00:33:
On 2018-07-31 18:42, Brett Cannon wrote:
then we will have to provide an FFI compiler for people to use in at least the simple cases.
Cython is *not* an FFI tool. It can be used for FFI but that's just one of its many use cases.
Just to make that point clearer, people commonly use Cython for three different main use cases:
a) Wrap native libraries for CPython (and less commonly for PyPy) with a pythonic interface. The cool feature there is that you can write python(-like) code that compiles down into the C layer and runs there, i.e. you can trivially make the wrapper as thin or thick as you want, without sacrificing performance. (This is pretty much the FFI case.)
b) Speed up Python code by compiling and optimising it using C data types. Here, Cython supports a very smooth transition from Python semantics and features down to low-level C speed and semantics, while still writing Python code (or very Python-like code, if you want) all along the way. You can even use Python type annotations for that these days.
c) Write C/C++ code without having to write C code. From the perspective of someone who has to write native code, statically typed Cython code compiles to the expected C code (when disabling the safety belts), but has a much nicer syntax, native access to the complete (C)Python and C ecosystems, and all Python features built into the language. Quite a number of people use it to write the C/C++ code they need but without the complex and error prone syntax.
Now, all of these use cases are covered by the same programming language. From a Cython perspective, there is no difference between them.
Thus, I don't see a reasonable place to make a cut to reach a "minimal" tool. Especially not one that hasn't been written yet. I mean, random people start writing a new "Python compiler" every couple of months [1], eventually notice that it's fun to start but not as easy as they thought, that they have neither the time nor the resources to complete it and/or turn it into something that gives a benefit to its potential users, and then abandon the project more or less.
I understand that all of that is, you know, open-source and scratching your own itch and all that, but I would be very glad if there was a way to channel these resources better, specifically into the tools that have achieved giving that benefit to a large user base.
Stefan
[1] The graveyard of "Python implementations", probably incomplete, is not a small one: https://wiki.python.org/moin/PythonImplementations