Re: Idea: ifdef-like feature to ease userland BC

From: Date: Sun, 09 Mar 2014 05:41:05 +0000
Subject: Re: Idea: ifdef-like feature to ease userland BC
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-73020@lists.php.net to get a copy of this message
Hi! > especially with (radical) userland API changes coming up in PHP6, > might I suggest something like a ifdef feature which turns blocks of > code into comments? How is it supposed to be implemented? PHP has no separate "compile-time" than can produce significant improvement in performance, like C-like languages do, and given opcode caching, such conditions should either be resolved statically - which means limited usability, as you'd have to drive them off something that you can use no code to define, or use some logic to resolve them dynamically, which logic would probably take nearly as much time and space as regular if() would. > This would allow framework authors to provide backwards compatibility > with "older" PHP versions while being able to take advantage of new > PHP features. This can easily be done by a set of includes and using version checks, function_exists, class_exists and such. The performance hit in case those are not needed would be very minimal and probably not warranting new language construct addition. > In theory, it could also be supplied as "update" to the already > existing minor versions (5.4,5.5 and 5.6) so that these versions can > also use the new code. Not likely for stable ones. According to our release process, we do not add language features in old stable versions, and the additions are limited to bugfixes and small self-contained features. Adding such feature would hardly qualify as one of those. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#73020) next »