Re: Re[8]: Need a more elegant way of bitwise ORing values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-06-13 at 15:59 +0100, Richard Davey wrote:
> Hi Robert,
> 
> Wednesday, June 13, 2007, 3:37:38 PM, you wrote:
> 
> > Personally I hate constants (can't use non-scalar values so why get used
> > ot them... also they're just another point for name collision) so if it
> > were my own code I'd do something more like the following:
> 
> Sure, but the filter extension uses them, which is where they come
> from. They aren't of my own creation, and I cannot assume that the
> values assigned to them won't change in the future, so can't hardcode
> my way around them.

That's an excellent reason to use constants :)

> I don't have anything against side-wide constants myself (no worse
> than an array shoved into $GLOBALS) but PHP seems to be moving more
> and more towards the use of constants within extensions as function
> parameters, PDO being another popular culprit that springs to mind.

Yeah, I consider constants and globals to be very similar. For the most
part I only use globals as site-wide configuration directives and even
then I usually double nest them according to what they modify. It is
quite reasonable that extensions would prefer constants over globals
though since the values as far as they are concerned should be
read-only.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux