I’m kind of stuck with a pre-existing code-base that cannot be substantially 
changed at this time...

I guess I can just make it a class variable, even if it never “varies” in the 
script, which to me screams “const”
[shrug]

From: Nathan Nobbe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2008 11:14 AM
To: Richard Lynch
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] Re: class const versus define

On Wed, Sep 24, 2008 at 7:35 AM, Richard Lynch <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:
I need the PATH to differ in development, staging, and production due to mixed 
environments.

factory *cough*

Unfortunately, I CANNOT construct a class const "on the fly" from global 
define'd constants and constant strings.

no, but you could select a class on the fly from globally defined constants.
So, in fact, I'd LIKE to use the class const properly for what it is mean for, 
but cannot do that because its value depends upon the environment.

i tend to agree w/ Jocheem here, if the value is something that will vary, 
perhaps it is best implemented as an instance variable rather than a constant.  
a factory method which took $path, or $env (something like that) could easily 
select an appropriate concrete class to instantiate.

-nathan

_______________________________________________________

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

Reply via email to