You are here: Re: [PHP] PHP5 class constants « PHP « IT news, forums, messages
Re: [PHP] PHP5 class constants

Posted by "Richard Lynch" on 10/29/05 23:22

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация