RE: [PHP-DEV] Constants in namesapces
| From: | Dmitry Stogov | Date: | Wed, 22 Aug 2007 14:57:35 +0000 |
| Subject: | RE: [PHP-DEV] Constants in namesapces | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31844@lists.php.net to get a copy of this message | ||
Good point.
We'll need to discuss this.
Thanks. Dmitry.
> -----Original Message-----
> From: Antony Dovgal [mailto:antony@zend.com]
> Sent: Wednesday, August 22, 2007 5:21 PM
> To: Dmitry Stogov
> Cc: 'Johannes Schlьter'; 'PHP Internals List'
> Subject: Re: [PHP-DEV] Constants in namesapces
>
>
> On 22.08.2007 17:03, Dmitry Stogov wrote:
> > You can have "const" outside namespaces but they are not real
> > compile-time constants. They are set during execution in
> the same way
> > as define() does.
> >
> > <?php
> > const DIR = dirname(__FILE__);
> > echo DIR;
> > ?>
>
> Don't you think it's bad idea to use the same 'const' syntax,
> but different behavior? I believe it would be really
> confusing for users, as class constants are set in compile time,
> thus 'const DIR = dirname(__FILE__);' is not possible.
>
> --
> Wbr,
> Antony Dovgal
>