Cc: 'PHP Internals List'
> Subject: RE: [PHP-DEV] Constants in namesapces
>
>
> On Wed, August 22, 2007 8:03 am, Dmitry Stogov wrote:
> > You can have "const" outside namespaces but they are not real
> > compile-time constants.
> > They are
26, 2007 7:50 AM
> To: Dmitry Stogov
> Cc: 'PHP Internals List'
> Subject: RE: [PHP-DEV] Constants in namesapces
>
>
> On Wed, August 22, 2007 8:03 am, Dmitry Stogov wrote:
> > You can have "const" outside namespaces but they are not real
> > compi
On Wed, August 22, 2007 8:03 am, 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.
>
> const DIR = dirname(__FILE__);
> echo DIR;
> ?>
You do realize this is going to e
On Thu, August 23, 2007 5:52 pm, 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...
At the risk of starting another packages
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 Archi
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
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN:
Stanislav Malyshev wrote:
>>
>> define(__NAMESPACE__.'::FOOBAR', $value) will work out of the box.
>
> Yep, works, but looks not so nice either. I have an idea: add an
> operator which prepends __NAMESPACE__.'::'. I.e. say we name if
> ns_fullname (I know, this name sucks, get me better one :), so
On Thu, 2007-08-23 at 13:30 -0700, Stanislav Malyshev wrote:
> > Special FUNCTION to do "__NAMESPACE__.'::'?!
> > Sheesh..
>
> Operator, not function.
I don't think it's worth having an additional operator. const will work
for much stuff, and the rest should imo do fine with that
__NAMESPACE__.':
Special FUNCTION to do "__NAMESPACE__.'::'?!
Sheesh..
Operator, not function.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www
On 23.08.2007 23:56, Stanislav Malyshev wrote:
define(__NAMESPACE__.'::FOOBAR', $value) will work out of the box.
Yep, works, but looks not so nice either. I have an idea: add an
operator which prepends __NAMESPACE__.'::'.
Special FUNCTION to do "__NAMESPACE__.'::'?!
Sheesh..
I.e. say we
define(__NAMESPACE__.'::FOOBAR', $value) will work out of the box.
Yep, works, but looks not so nice either. I have an idea: add an
operator which prepends __NAMESPACE__.'::'. I.e. say we name if
ns_fullname (I know, this name sucks, get me better one :), so you'd say:
define(ns_fullname('F
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);
That'd be hard - in runtime, you don't have namespace name. So either we
should make define() an operator, or pass names
in that context.
johannes
> Thanks. Dmitry.
>
>
> > -Original Message-
> > From: Stanislav Malyshev [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 22, 2007 10:43 PM
> > To: Antony Dovgal
> > Cc: Dmitry Stogov; 'PHP Internals List'
> >
On 23.08.2007 13:46, 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.
We also can extend define() with additional argument that will allow to
create namespace
tring $var, mixed $val, bool namespace_constant = false);
Thanks. Dmitry.
> -Original Message-
> From: Stanislav Malyshev [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 22, 2007 10:43 PM
> To: Antony Dovgal
> Cc: Dmitry Stogov; 'PHP Internals List'
> Subject:
The latter would be hard to do since class definition is a runtime
Read "compile-time" here :)
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
We do have runtime constants created with define(), so the critical need
in runtime namespace constants is quite questionable to me.
"Critical need" is a matter of definition. You can do
define(__NAMESPACE__.'::foo', 'bar') but frankly, it sucks. const foo =
'bar' looks so much better. That sa
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
On 22.08.2007 22:25, Stanislav Malyshev wrote:
We do have runtime constants created with define(), so the critical need
in runtime namespace constants is quite questionable to me.
"Critical need" is a matter of definition. You can do
define(__NAMESPACE__.'::foo', 'bar') but frankly, it sucks.
On 22.08.2007 21:50, Stanislav Malyshev wrote:
I don't think it's _required_ for the constants to be useful.
Well, depends on how you define requirements. Having out-of-class
constants is not required either - Java does fine without it :) However,
thinking about how people would use namespace
Which basically means class constants are useless in their current
state, right?
No, they are useful for some things (pre-defined values) and useless for
others (expressions). The problem is that in classes we can do these
other things - with variables. And in global space, with define(). In
On 22.08.2007 21:08, Stanislav Malyshev wrote:
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.
That's a goo
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.
That's a good point. However, "constant constants" - i.e., o
On 8/22/07, Dmitry Stogov <[EMAIL PROTECTED]> wrote:
> We never resolved constants in compile time,
I know that, hence my "see pecl hidef" comment.
> because constants' values may
> be unknown in compile time.
The idea behind that was to get constants like internal constants. If
it is a integer
Good point.
We'll need to discuss this.
Thanks. Dmitry.
> -Original Message-
> From: Antony Dovgal [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 22, 2007 5:21 PM
> To: Dmitry Stogov
> Cc: 'Johannes Schlьter'; 'PHP Internals List'
> Sub
lьter; PHP Internals List
> Subject: Re: [PHP-DEV] Constants in namesapces
>
>
> On 8/22/07, Dmitry Stogov <[EMAIL PROTECTED]> wrote:
> > You can have "const" outside namespaces but they are not real
> > compile-time constants. They are set during execution in
yes. keep it consistent. if that means sacrificing features, so be it.
David
Am 22.08.2007 um 15:20 schrieb Antony Dovgal:
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
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.
Don't you think it's bad idea to use the same 'const' syntax, but different
behavior?
I believe it w
On 8/22/07, Dmitry Stogov <[EMAIL PROTECTED]> 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.
>
> const DIR = dirname(__FILE__);
> echo DIR;
> ?>
Off topic but this const makes me th
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.
Thanks. Dmitry.
> -Original Message-
> From: Johannes Schlьter [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 22, 2007 4:48 PM
> To
30 matches
Mail list logo