<br><br><div class="gmail_quote">On Tue, May 15, 2012 at 12:59 PM, mark florisson <span dir="ltr"><<a href="mailto:markflorisson88@gmail.com" target="_blank">markflorisson88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 15 May 2012 17:34, Armin Rigo <<a href="mailto:arigo@tunes.org">arigo@tunes.org</a>> wrote:<br>
> Hi Yury,<br>
><br>
> On Tue, May 15, 2012 at 5:56 PM, Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com">yselivanov.ml@gmail.com</a>> wrote:<br>
>> While I don't like some design quirks of Cython, I think that it's far<br>
>> better than any ffi or ctypes-like solution. Essentially, it's an ffi<br>
>> merged with the language, not a separate module. And that's a pretty<br>
>> unique approach. Why not focus on improving Cython design and moving<br>
>> toward some superset of Python language, that every implementation<br>
>> should support natively?<br>
><br>
> I'm quite sure it will never happen. See for example the new section<br>
> "Pure Python Mode" in <a href="http://docs.cython.org/src/tutorial/pure.html" target="_blank">http://docs.cython.org/src/tutorial/pure.html</a>:<br>
> it is again about adding ffi-like glue to Python files. It is a<br>
> reasonable next step in the Cython project, but it shows precisely<br>
> that there is no chance to add all of Cython into the Python language<br>
> definition.<br>
><br>
> If I got you correctly, such ffi-like glue code is the part that you<br>
> dislike. I agree with you, but I don't think we can hope for a<br>
> solution with no glue at all; instead, we can try to minimize it as<br>
> much as possible. I may be wrong, but until proven otherwise, I am<br>
> under the impression that LuaJIT's approach leads to significantly<br>
> less glue code than Cython's Pure Python Mode. (This is true even<br>
> though the former is complete and the latter so far not: from the<br>
> Cython docs, "A limited attempt is made to emulate these more complex<br>
> types, but only so much can be done from the Python language.")<br>
><br>
><br>
> A bientôt,<br>
><br>
> Armin.<br>
> _______________________________________________<br>
> pypy-dev mailing list<br>
> <a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">http://mail.python.org/mailman/listinfo/pypy-dev</a><br>
<br>
</div></div>We have been discussing a proposal to add a mechanism to perform<br>
native calls fast given a Python object. E.g. if a JIT, or Cython<br>
code, suspects a certain signature, it can query the object for that,<br>
and if valid call the function natively through a pointer, allowing<br>
also for specializations. This could work from Cython (e.g. when<br>
calling a function with typed arguments/return value, or when casting<br>
the function object explicitly to a typed C function pointer), but<br>
this information can also be used by a JIT to call into native code<br>
quickly.<br>
<br>
The details of the proposal are here:<br>
<a href="http://wiki.cython.org/enhancements/cep1000" target="_blank">http://wiki.cython.org/enhancements/cep1000</a> . I guess the question is,<br>
will this project also try to expose an interface along these lines?<br>
It would standardize an efficient mechanism to deal with wrapped<br>
native code. The CEP was not originally designed for functions wrapped<br>
by an FFI (more for callback wrappers of native code, such as numba or<br>
cython functions), but it can be used to wrap any native code.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
pypy-dev mailing list<br>
<a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">http://mail.python.org/mailman/listinfo/pypy-dev</a><br>
</div></div></blockquote></div><br>FWIW my project is available here: <a href="https://github.com/alex/yaffi">https://github.com/alex/yaffi</a>. It's very incomplete (only docs, which are also incomplete :P, ATM).<br>
<br>Alex<br clear="all"><br>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>"The people's good is the highest law." -- Cicero<br>
<br>