Am 16.08.2013 01:42 schrieb "Stas Malyshev" <smalys...@sugarcrm.com>:
>
> But this is not the most tricky part. The most tricky part is this:
> if(true) return;
> class Foo {
> const halfpie = M_PI/2;
> }
>
> Now what happens if this is implemented as an opcode? We can't run any
> opcodes past return statement, but Foo is expected to be defined here.

Couldn't the opcodes for such behind-the-scenes initialization be generated
as the first thing of the '(main)' opcode stream, so that they would run
before it comes to the "if (true) return;" ?

Once that is in place, make classes have an optional on-first-use opcode
stream, too:
- emit calls to that in the file's up-front opcode stream for each locally
defined class that has them
- in that per-class initializer stream, expression evaluation even for
non-constant initializers (protected $foo = anything::whatever()*10;) could
be put
- and also a call to the much talked about static class initializer function
- all in strict definition order, with fallout related to interdependance
left to confuse class authors :)

best regards
  Patrick

Reply via email to