On Thu, Jan 8, 2015 at 6:35 PM, François Laupretre <franc...@tekwire.net> wrote: >> De : Pierre Joye [mailto:pierre....@gmail.com] >> >> > We solved some of the other problems by only allowing definitions, no >> side-effects - classes, constants, namespaces etc. We do not allow code >> outside of a function body here. >> >> Yes, we will have to do that, no matter what we choose. I am however >> not sure how to do it with the current engine design. Using >> zend_compile (or a derived implementation) may help. > > Is there a technical problem with code located outside of definitions, or is > it just a convention (PSR already contains this rule) ? I understand the > problems it poses in HHVM, but I don't see why we should check that with the > engine as it is structured now. Even if we can detect such questionable usage > (and we can detect it quite easily just using tokenizer output), IMO, we are > not responsible of what developers put in their scripts.
I was too vague. If some code is loaded and part of it will be always executed even if not used at all in a request, this will have side effects. Also besides the impact of having code being ran on each request, I do not think it is good idea to being to have top context running code, at all :) Cheers, -- Pierre @pierrejoye | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php