Re: Constants in namesapces
| From: | Larry Garfield | Date: | Fri, 24 Aug 2007 05:14:21 +0000 |
| Subject: | Re: Constants in namesapces | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31890@lists.php.net to get a copy of this message | ||
On Thursday 23 August 2007, Stanislav Malyshev wrote:
> > define_ns('FOOBAR', $value);
>
> Can be, but there's two downsides:
> 1. define_ns would be weird construct - it would be combined
> function/operator
> 2. operators with underscores look bad...
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
Didn't someone at some point already suggest:
define('foo', $bar); // runtime, not namespace-affected
const foo = 'bar'; // compile-time, namespace-affected
That way the const works the same with the same limitations as a class const
(which, being inside a class, is namespace-affected), while define() keeps
working just as it always has.
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson