# my last attempt at sanity with namespaces

- Thread: https://externals.io/message/41152
- Original archive: https://news-web.php.net/php.internals/41152
- Started by Edmund Tam on 2008-10-16T17:34:07+00:00
- Messages: 2
- 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

---

## #41152 — Edmund Tam — 2008-10-16T17:34:07+00:00

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

Hello all,

Sorry to post here being an "outsider".
I didn't post because I know nothing about the internals, really.
However after some incomplete thought I have a not very thorough
suggestion about the ambiguity issue mentioned in the RFC wiki.
I would like to ask if this is possible.

Let me quote the challenge here:

<quote>
// is this class one::step or namespace one::step?
one::step::two();
</quote>

Is is possible that the engine first looks for
classes, then namespaces? So
"one::step::two();" should always result in:

Namespace: one
Class: step
Static Method: two

Now the "ambiguity" is resolved.
If we want to really mean namespace "one::step" and function two(),
one must explicitly write the following:

(one::step)::two();

Yes, parenthesis, just like when we want to write (1 + 2) * 3.

So my question is: can parenthesis play a part in namespace resolving?

There can be problem, e.g. I don't know if the engine can distinguish it
from typecasting without many efforts. But anyway I hope this doesn't
sound too stupid :).

T


>Hi,
>
>http://wiki.php.net/rfc/namespaceissues
>
>Read it and discuss.  Let's be clear people: the technical problems in
>namespaces are limited and solvable.  The problems in the political
>environment surrounding them may not be.  Wouldn't politics be a
>stupid-ass reason to remove namespaces?
>
>Greg

---

## #41156 — Nathan Rixham — 2008-10-16T17:45:27+00:00

URL: https://externals.io/message/41152#41156 · In reply to: #41152

Edmund Tam wrote:
> 
> (one::step)::two();
> 
> Yes, parenthesis, just like when we want to write (1 + 2) * 3.
> 
> So my question is: can parenthesis play a part in namespace resolving?
> 

see this is the problem and where the solution should be (imo)

mynamespace::anotherspace::somespace <<makes sense
class::method() <<makes sense

it's when you join the two together that the ambiguity comes in

so the solution should be some way of visually and technically defining 
where a namespace-path ends

only solutions are:

parenthesis around the namespace-path:
(mynamespace::anotherspace::somespace)class::method()

or a separator at the end of the namespace-path (greg's option 2)
mynamespace::anotherspace::somespace:::class::method() [:::]
mynamespace::anotherspace::somespace:>class::method() [:>]
mynamespace::anotherspace::somespace class::method() [ (space)]
mynamespace::anotherspace::somespace..class::method() [..]

anything clear and unambiguous visually!
