Fixed in commit 9a0afcbcec8416c1d56bdced68a3f993e7be9d3c Author: Stefan Seifert <n...@detonation.org> Date: Wed Aug 16 20:27:11 2017 +0200
RT 131898: Fix native closures failing on the second run On the first call of a native sub we create a new subroutine body and replace the original (stored in the routine's $!do attribute). We also set the invocation spec so the body will be called instead of the CALL-ME method. This invocation spec is shared between an original routine and it's clones. If the routine is a clousre, the body won't be shared as only a clone of the routine will be actually visible in the lexical scope. So until someone comes up with a better idea, we won't create an optimized version for a closure anymore.