Re: PHP5 class constants

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

 



On Thu, October 27, 2005 9:56 pm, Chris wrote:
> Though I suppose you could make an argument for using expressions that
> consist of only constant values.

Actually...

One could argue that so long as the programmer was willing to accept
the consequences, there could be many legitimate circumstances in
which one might WANT to utilize non-constant values for a const.

Off the top of my head, there are:
1. A 'random' value which should be set for the course of the run/script
2. An environment 'variable' which comes from some external source.
3. A time() [and friends] value for profiling
4. Time computations such as (60*60*24).

[Re #4] Not all Programmers have memorized and immediately recognize
the value that 60*60*24 works out to, but they'd be hard pressed to
not recognize those numbers as seconds/minutes/hours...

In some languages, it is possible to use a pre-processor construct to
have the interpreter/compiler compute a value in its first-pass, and
to store that value as a constant in the program for actual execution.

#. was what I recall from Lisp, about a decade ago. It was quite
useful in many cases.

I'm pretty sure C's macros and pre-processor macros and all that junk
that gave me headaches was (partially) meant to accomplish the same
thing. :-)

I'm not sure PHP *needs* this feature, but I can certainly see that it
would be useful to a lot more programmers than some stuff that is
being worked on for PHP5+. :-) :-) :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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