3 ms·
That's a good point, and is an language design/implementation specific condition. PHP doesn't create a new stack frame for eval'ed code, so it runs right in th
by thwarted 15y ago
That's a good point, and is an language design/implementation specific condition. PHP doesn't create a new stack frame for eval'ed code, so it runs right in the context of the calling function. In constrast, LambdaMOO does create a separate stack frame, which is subjected to the same scope rules as any other function call. You can control if it does or not in perl (by stuffing some additional syntax into the eval'ed string).
But the usual issue that is bandied about is how it's inefficient because it needs to invoke the code parser. Searching hacker news for eval shows the wide range of positions, a lot (but not a wide majority) just parrot the inefficiency argument. But there are also a few posts with solid reasons to use eval too.