Re: [apd][patch] Two new functions: override_constant() and rename_constant()
| From: | Johannes Schlueter | Date: | Mon, 13 Sep 2004 18:44:05 +0000 |
| Subject: | Re: [apd][patch] Two new functions: override_constant() and rename_constant() | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1331@lists.php.net to get a copy of this message | ||
Hi Derick,
Derick Rethans wrote:
> Just wondering, but why the hell would you want to change *constants*? :)
I once had such a situation while debugging a larger application whos
programmer _really_ liked using constants and I wanted to change the
bahaviour without breaking other modules so I had to change one constant
all over this module. With such a function in a debugging extension I'd
have changed the sources to see wether this really fixes my problem and
then changed the source where needed and removed the renaming - but yes,
these are very rare situations...
(Another reason for these functions: I wasn't sure wether constants are
replaced at compile or at runtime, but it looks like I'm not the only one
who didn't know the answer to this question ;-))
btw. the original patch has - at least - two issues, which should be easyto
fix (if someone is interestedin these..):
- I don't set the module_number (I'm not sure wether an overriden internal
constant is still an internal constant or an user-defined one)
- override_constant() don't check wether the value is a valid data type so
it is possible to put an object or an array into the constant (even though
it seems to work, if one would call such a thing "constant"...)
So, if someone is interested in this thing I can fix these things and create
a new patch, otherways I put it into my patches directory and forget about
it - I don't mind that much, it isn't my identity ;-)
johannes