# Namespace question

- Thread: https://externals.io/message/31690
- Original archive: https://news-web.php.net/php.internals/31690
- Started by David Coallier on 2007-08-17T16:23:41+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31690 — David Coallier — 2007-08-17T16:23:41+00:00

URL: https://externals.io/message/31690#31690

Hey guys, looking at the minutes meeting from the paris conf
(http://php.net/~derick/meeting-notes.html), I was wondering if  "
Constants in name spaces are allowed unless we find problems with the
implementation. " were implemented. I tried but  putting

namespace MyPackage;
const NAME = 'inspace';


Then I get a parse error. (Unexpected T_CONST..)

Is that normal ? Looking at the minutes notes I can not really see
what of this list that has been discussed by the attendees has been
implemented.

Enlighten me someone please.

And yes these notes were built nearly 2 years ago.

Thanks for your replies.

-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

---

## #31692 — Alexey Zakhlestin — 2007-08-17T16:34:00+00:00

URL: https://externals.io/message/31690#31692 · In reply to: #31690

"const" keyword is currently allowed only inside class-definitions;
generic constants are specified using "define()"


> Hey guys, looking at the minutes meeting from the paris conf
> (http://php.net/~derick/meeting-notes.html), I was wondering if  "
> Constants in name spaces are allowed unless we find problems with the
> implementation. " were implemented. I tried but  putting
>
> namespace MyPackage;
> const NAME = 'inspace';
>
>
> Then I get a parse error. (Unexpected T_CONST..)
>
> Is that normal ? Looking at the minutes notes I can not really see
> what of this list that has been discussed by the attendees has been
> implemented.
>
> Enlighten me someone please.
>
> And yes these notes were built nearly 2 years ago.
>
> Thanks for your replies.
>
> --
> David Coallier,
> Founder & Software Architect,
> Agora Production (http://agoraproduction.com)
> 51.42.06.70.18
>
> --
> 
> 
>
>


-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #31696 — David Coallier — 2007-08-17T16:43:39+00:00

URL: https://externals.io/message/31690#31696 · In reply to: #31692

> "const" keyword is currently allowed only inside class-definitions;
> generic constants are specified using "define()"
>

I know that..
Right now you can do.

--File: ns.php--
namespace What
define ('NAME', 'booo');

class Tester
{
    public function __construct()
    {
        echo 'yeah.. no!';
    }
}


--File: testns.php--
require 'ns.php';

echo NAME; // Will echo booo without importing the namespace

// And

$obj = new Tester; // This as it should do, will return an error.

// Change to that:

import What as A;
$obj = new A::Tester; // This will echo yeah...No as it should.



So my question is: Anyone thinking in doing const for namespaces thus
calling something like

What::NAME; // echo 'booo'


?

> 
> > […]
>
>
> --
> Alexey Zakhlestin
> http://blog.milkfarmsoft.com/
>


-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

---

## #31704 — Stanislav Malyshev — 2007-08-17T17:23:10+00:00

URL: https://externals.io/message/31690#31704 · In reply to: #31696

> So my question is: Anyone thinking in doing const for namespaces thus
> calling something like
> 
> What::NAME; // echo 'booo'

Yep, we are thinking of allowing const in namespace (and maybe even 
outside, since it'd be basically the same) but we didn't arrive yet to 
any decision if we can implement it in a good way - there's some 
ambiguity which can have negative impact on performance, we'd need to 
see how we can deal with it.
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #31705 — David Coallier — 2007-08-17T17:27:29+00:00

URL: https://externals.io/message/31690#31705 · In reply to: #31704

> > […]
>
> Yep, we are thinking of allowing const in namespace (and maybe even
> outside, since it'd be basically the same) but we didn't arrive yet to
> any decision if we can implement it in a good way - there's some
> ambiguity which can have negative impact on performance, we'd need to
> see how we can deal with it.
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com   http://www.zend.com/
> (408)253-8829   MSN: stas@zend.com
>
>

Awesome thanks,

-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

---

## #31826 — Dmitry Stogov — 2007-08-22T05:59:16+00:00

URL: https://externals.io/message/31690#31826 · In reply to: #31690

We are working on this feature and additional patch will be posted for
review on this week.

Thanks. Dmitry.

> -----Original Message-----
> From: david.coallier@gmail.com 
> [mailto:david.coallier@gmail.com] On Behalf Of David Coallier
> Sent: Friday, August 17, 2007 8:24 PM
> To: PHP Internals List
> Subject: [PHP-DEV] Namespace question
> 
> 
> Hey guys, looking at the minutes meeting from the paris conf 
> (http://php.net/~derick/meeting-notes.html), I was wondering 
> if  " Constants in name spaces are allowed unless we find 
> problems with the implementation. " were implemented. I tried 
> but  putting
> 
> namespace MyPackage;
> const NAME = 'inspace';
> 
> 
> Then I get a parse error. (Unexpected T_CONST..)
> 
> Is that normal ? Looking at the minutes notes I can not 
> really see what of this list that has been discussed by the 
> attendees has been implemented.
> 
> Enlighten me someone please.
> 
> And yes these notes were built nearly 2 years ago.
> 
> Thanks for your replies.
> 
> -- 
> David Coallier,
> Founder & Software Architect,
> Agora Production (http://agoraproduction.com)
> 51.42.06.70.18

---

## #31846 — David Coallier — 2007-08-22T15:13:49+00:00

URL: https://externals.io/message/31690#31846 · In reply to: #31826

> We are working on this feature and additional patch will be posted for
> review on this week.
>
> Thanks. Dmitry.
>
> > […]
>
>

Ah ok, the discussions were quick.


-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18
