Preprocessor?
| From: | John Coggeshall | Date: | Tue, 08 Apr 2003 21:33:51 +0000 |
| Subject: | Preprocessor? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-809@lists.php.net to get a copy of this message | ||
I've been thinking about this for awhile, and seeing these patches about
'const' at compile-time I thought I would throw this in here now...
Instead of patching the engine for these constant values, wouldn't these
things be better served in a module? I've already worked on a basic
module that hooks into zend_compile() and does pre-processing before
giving the script over to PHP... Hence you'd have something identical to
C's preprocessing.
<?php
#define MYVAR 1;
Echo MYVAR;
?>
If there is interest, I'd like to be able to include this module in PHP5
once its been cleaned up...
John
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
>-----Original Message-----
>From: Chris Vandomelen [mailto:chrisv@revhosting.com]
>Sent: Tuesday, April 08, 2003 3:45 PM
>To: internals@lists.php.net
>Subject: [PHP-DEV] [PATCH] 'const' in global scope
>
>
>In tune with the current 'const' patches by Sterling, and
>because I found it useful (and more consistent than the
>original behaviour IMHO), attached is a patch which implements
>compile-time constants in the global scope:
>
><?php
>
>const something = 2, something_else = 4;
>
>?>
>
>The behaviour is the same as define(), only implemented in the
>compiler instead of as a function.
>
>Chris
>