On Wed, Nov 19, 2014 at 07:17:48PM +0100, Julien Pauli wrote:

> [Off Topic]
> 
> It's been a long time I've been thinking about having a compile-time
> preprocessor integrated into our parser/compiler stack.
> I would design it just to support #migration tokens, and nothing more.
> This would really ease migrations, with no runtime impact at all, and
> the possibility to use any syntax, knowing it will get compiled, which
> is not possible nowadays.
> Like the C preprocessor. And it wouldn't be that hard to add to our
> codebase, as there should not be any runtime impact, just a two-pass
> parser
> 
> Anyone interested can contact me :-)
> 
> [/Off Topic]

If you do, then please back port it to at least PHP 5.3 If you did then we would
be able to write code with new syntaxes (that won't compile under 5.3/whatever)
and automatically use them when the code is run under whatever version supports
the syntax.

Going back to the example that I gave & thinking a bit, a '$#' at the start of
line (not recognised anywhere else) would work. It is an error under different
circumstances and is sufficiently reminicent of C to be helpful of those of us
with that background.

$# if PHP_VERSION_ID > 50500
$# else
$# endif

Without wanting to make it too complicated, it might be nice to allow a 'set'
(or 'define'), this would allow setting of flags, eg:

$# if PHP_VERSION_ID > 50500
$# set FINALLY 1
$# endif

$# if FINALLY
 ...
$#endif

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to