On Wed, Jun 15, 2016 at 2:55 PM, Yichao Yu <yyc1...@gmail.com> wrote:
> On Wed, Jun 15, 2016 at 2:44 PM, Ford O. <fordfo...@gmail.com> wrote:
>> Can you explain me what exactly happens, because I am completely lost...
>
> It is the intended behavior and doing it otherwise will have a huge
> performance hit since the compiler has no way to know what you are
> doing.

Even more detail. `eval` cannot be statically optimized/analyzed
without solving the halting problem (you are basically asking the
compiler to reason about an arbitrary value (the expression to be
evaluated) at compile time).

Doing it dynamically should be possible in principle. But it's a much
harder problem and much less reliably and allowing local eval will
decrease the performance of code that doesn't even use this feature
(since the compiler has to allow it) It seems that other JIT doesn't
optimize this well either (I'm actually a little bit surprised that
PyPy's tracing JIT doesn't optimize a simple) so it must be even
harder (or doesn't worth optimizing) than I thought.

Reply via email to