<br><br><div class="gmail_quote">On Tue, May 15, 2012 at 12:59 PM, mark florisson <span dir="ltr">&lt;<a href="mailto:markflorisson88@gmail.com" target="_blank">markflorisson88@gmail.com</a>&gt;</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 &lt;<a href="mailto:arigo@tunes.org">arigo@tunes.org</a>&gt; wrote:<br>
&gt; Hi Yury,<br>
&gt;<br>
&gt; On Tue, May 15, 2012 at 5:56 PM, Yury Selivanov &lt;<a href="mailto:yselivanov.ml@gmail.com">yselivanov.ml@gmail.com</a>&gt; wrote:<br>
&gt;&gt; While I don&#39;t like some design quirks of Cython, I think that it&#39;s far<br>
&gt;&gt; better than any ffi or ctypes-like solution.  Essentially, it&#39;s an ffi<br>
&gt;&gt; merged with the language, not a separate module.  And that&#39;s a pretty<br>
&gt;&gt; unique approach.  Why not focus on improving Cython design and moving<br>
&gt;&gt; toward some superset of Python language, that every implementation<br>
&gt;&gt; should support natively?<br>
&gt;<br>
&gt; I&#39;m quite sure it will never happen.  See for example the new section<br>
&gt; &quot;Pure Python Mode&quot; in <a href="http://docs.cython.org/src/tutorial/pure.html" target="_blank">http://docs.cython.org/src/tutorial/pure.html</a>:<br>
&gt; it is again about adding ffi-like glue to Python files.  It is a<br>
&gt; reasonable next step in the Cython project, but it shows precisely<br>
&gt; that there is no chance to add all of Cython into the Python language<br>
&gt; definition.<br>
&gt;<br>
&gt; If I got you correctly, such ffi-like glue code is the part that you<br>
&gt; dislike.  I agree with you, but I don&#39;t think we can hope for a<br>
&gt; solution with no glue at all; instead, we can try to minimize it as<br>
&gt; much as possible.  I may be wrong, but until proven otherwise, I am<br>
&gt; under the impression that LuaJIT&#39;s approach leads to significantly<br>
&gt; less glue code than Cython&#39;s Pure Python Mode.  (This is true even<br>
&gt; though the former is complete and the latter so far not: from the<br>
&gt; Cython docs, &quot;A limited attempt is made to emulate these more complex<br>
&gt; types, but only so much can be done from the Python language.&quot;)<br>
&gt;<br>
&gt;<br>
&gt; A bientôt,<br>
&gt;<br>
&gt; Armin.<br>
&gt; _______________________________________________<br>
&gt; pypy-dev mailing list<br>
&gt; <a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
&gt; <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&#39;s very incomplete (only docs, which are also incomplete :P, ATM).<br>
<br>Alex<br clear="all"><br>-- <br>&quot;I disapprove of what you say, but I will defend to the death your right to say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>&quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
<br>