ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-general
php-general
Re: [PHP] PHP5 class constants
by Richard Lynch other posts by this author
Oct 29 2005 1:23PM messages near this date
Re: [PHP] PHP5 class constants | [PHP] Decompressing a string with zlib problems
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
Thread:
Dragan Stanojevic - Nevidljivi
Jasper Bryant-Greene
Dragan Stanojevic - Nevidljivi
Chris
Richard Lynch

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved