RE: [PHP-DEV] Constants in namesapces

From: Date: Thu, 23 Aug 2007 11:55:50 +0000
Subject: RE: [PHP-DEV] Constants in namesapces
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-31866@lists.php.net to get a copy of this message
Hi, On Thu, 2007-08-23 at 13:46 +0400, Dmitry Stogov wrote: > I think we must cut the patch to use only "compile-time" constants in > namespaces. > For runtime constants we can use existing define(). > > This will fix inconsistency. I think that would be good. > We also can extend define() with additional argument that will allow to > create namespace constant. > > function define(string $var, mixed $val, bool namespace_constant = false); It would be function define(string $var, mixed $val, bool case_insensitive = false, bool namespace_constant = false); since we already have the case-insesitive flag. In my opinion define(__NAMESPACE__.'::FOOBAR', $value); is good enough and clearer than define('FOOBAR', $value, false, true); where one has to think what "false" and "true" mean in that context. johannes > Thanks. Dmitry. > > > > -----Original Message----- > > From: Stanislav Malyshev [mailto:stas@zend.com] > > Sent: Wednesday, August 22, 2007 10:43 PM > > To: Antony Dovgal > > Cc: Dmitry Stogov; 'PHP Internals List' > > Subject: Re: [PHP-DEV] Constants in namesapces > > > > > > > I propose to define these constants in compile time or change class > > > constants to be defined in runtime. > > > > The latter would be hard to do since class definition is a runtime > > thing. Unless we make all classes be defined in runtime (and accept > > slowdown following from it) we don't have any point in time > > where class > > constants could be defined. Also, we don't have a good way to > > keep the > > expression and scope necessary for evaluating it. > > -- > > Stanislav Malyshev, Zend Software Architect > > stas@zend.com http://www.zend.com/ > > (408)253-8829 MSN: stas@zend.com > > >

« previous php.internals (#31866) next »