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

2007-06-13 Thread Robert Cummings
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



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

2007-06-13 Thread Richard Davey
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.

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.

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

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