# Namespaces: Technical proposal

- Thread: https://externals.io/message/20780
- Original archive: https://news-web.php.net/php.internals/20780
- Started by oliver.graetz@arcor.de on 2005-11-28T21:52:14+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #20780 — oliver.graetz@arcor.de — 2005-11-28T21:52:14+00:00

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

Hi folks!

I had some PM discussions about the (presumably premature) death of ":"
as the namespace symbol.

Most people liked this, some liked "::" (which will definetely NOT work)
and then the opinion was very split with a lot of people saying "OK, if
it has to be" to ":::". Some folks even resigned and went for the widely
hated "\". I'll recompile a table later this night with corrected
opinions (don't worry, I have redflagged all vote posts in my Thunderbird).

But now there might be a possibility to go with ":". Jessie will test
this out and I suppose he'll come out with results (hopefully positive).

Here's the idea: When the tokenizer encounters the opening "?" of the
ternary, it DEACTIVATES the namespace operator until the end of the
ternary. This way, all old code will behave as before, nothing will be
broken. Of course, this absolutely requires the use of parentheses if
one absolutely needs to use namespaces inside the ternary. As such cases
will be pretty rare, this is no big drawback. The good thing: no
whitespace magic is needed!

Comments?

OLLi

---

## #20781 — dz@bitxtender.com — 2005-11-28T21:54:27+00:00

URL: https://externals.io/message/20780#20781 · In reply to: #20780

Cool. If that won't work, I'd rather have ::: over \, please ;)

- David


Am 28.11.2005 um 22:52 schrieb Oliver Grätz:

> Hi folks!
>
> I had some PM discussions about the (presumably premature) death of  
> ":"
> as the namespace symbol.
>
> Most people liked this, some liked "::" (which will definetely NOT  
> work)
> and then the opinion was very split with a lot of people saying  
> "OK, if
> it has to be" to ":::". Some folks even resigned and went for the  
> widely
> hated "\". I'll recompile a table later this night with corrected
> opinions (don't worry, I have redflagged all vote posts in my  
> Thunderbird).
>
> But now there might be a possibility to go with ":". Jessie will test
> this out and I suppose he'll come out with results (hopefully  
> positive).
>
> Here's the idea: When the tokenizer encounters the opening "?" of the
> ternary, it DEACTIVATES the namespace operator until the end of the
> ternary. This way, all old code will behave as before, nothing will be
> broken. Of course, this absolutely requires the use of parentheses if
> one absolutely needs to use namespaces inside the ternary. As such  
> cases
> will be pretty rare, this is no big drawback. The good thing: no
> whitespace magic is needed!
>
> Comments?
>
> OLLi

---

## #20803 — Hartmut Holzgraefe — 2005-11-29T08:04:34+00:00

URL: https://externals.io/message/20780#20803 · In reply to: #20780

Oliver Grätz wrote:
> Here's the idea: When the tokenizer encounters the opening "?" of the
> ternary, it DEACTIVATES the namespace operator until the end of the
> ternary. This way, all old code will behave as before, nothing will be
> broken. Of course, this absolutely requires the use of parentheses if
> one absolutely needs to use namespaces inside the ternary. As such cases
> will be pretty rare, this is no big drawback. The good thing: no
> whitespace magic is needed!

this adds almost the same WTF? factor as requring whitespace,
and being a pretty rare case only adds to this ...

(not to mention that maintaining a parser with special state
rules like this becomes a WTF? PITA anyway ...)

-- 
Hartmut Holzgraefe, Senior Support Engineer                            .
MySQL AB, www.mysql.com

---

## #20823 — Hartmut Holzgraefe — 2005-11-29T12:34:29+00:00

URL: https://externals.io/message/20780#20823

Oliver Grätz wrote:
> Nope. Parentheses are a totally different thing here. Adding mandatory
> whitespace means giving syntactic meaning to something that normally
> never should have it. Meaningful whitespace is really evil. On the other
> side parentheses are already there. They are an existing concept of
> scoping evaluation. The idea simply consists of not having namespaces
> inside the ternary:

while i agree that the () approach is less bad than the whitespace one
it is still "bad enough" from an language orthogonally point of view ...

-- 
Hartmut Holzgraefe, Senior Support Engineer                            .
MySQL AB, www.mysql.com

---

## #20829 — Sara Golemon — 2005-11-29T15:27:21+00:00

URL: https://externals.io/message/20780#20829

> Just wondering. There's another thread about goto and labels running as 
> well. If they vote for something like:
>
> LABEL:while (cond) {
>
> }
>
> Wouldn't this add another technical diffuculty with using ':' as a 
> namespace seporator?
>
Fortunately this is another new feature so there's no old code to break. 
It's simply a matter of giving namespace:class precedence over label:expr.

Though yes, preventing that duality of meaning is a good thing.

-Sara
