Hello, 2012/4/9 Ángel González <keis...@gmail.com>: > On 09/04/12 20:23, Chris Stockton wrote: >> Hello, >> Although I am not very interested in this feature, if it is >> implemented I like the idea of flags instead of introducing new >> keywords. Maintaining backwards compatibility would be great >> considering the benefit to the feature to be completely honest (and in >> disagreement to many people, but I do understand the reasoning for >> everyone's interest in it) is extremely minor in my eyes. >> >> In addition I would suggest maybe using PHP_INCLUDE_* as a place for >> these constants to live. >> >> -Chris > That would still be a parse error. > Either > include "file.php", 5; > or > include ("file.php", 42); > > Fails with a parse error about unexpected ',' > > On the other hand, a new keyword can be written in a backwards > compatible way by making it look like a function call in a non-taken branch: > > *if ( version_compare(PHP_VERSION*, '5.5', '<') ) > include_once $file; > else > require_code($file, array( 'once'=>true, 'warn' => 'ignore' ) ); >
I am not sure I am following you here Angel, are you confusing backwards and forward compatibility? I wouldn't expect a feature to ever work forward compatibly. I.E. Can't use traits in php 4 and can't play a blu ray disc in a dvd player. The goal here is that if you have a large code base which has a hand rolled include_code function already, your change is backwards compatible with that code base. Same to be said for any constants, which is why I recommended using the reserved PHP_* space. -Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php