php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73347 Propose new namespace separator: dot inside a string
Submitted: 2016-10-19 10:48 UTC Modified: 2016-10-25 15:26 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fede dot carg at gmail dot com Assigned:
Status: Suspended Package: Class/Object related
PHP Version: 7.1.0RC3 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-10-19 10:48 UTC] fede dot carg at gmail dot com
Description:
------------
The backslash namespace separator was introduced in 2008 http://news.php.net/php.internals/41374

Would it be possible to consider using dots inside strings. Eg:


```
namespace "my.package";
use "some.package.class";
```

How difficult would it be for the interpreter to parse this line of code? For me, it the most modern and clean solution. And it looks much better, doesn't it?


Expected result:
----------------
```
namespace "my.package";
use "some.package.class";
```

Actual result:
--------------
```
namespace my\package;
use some\package\class;
```

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-25 15:26 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2016-10-25 15:26 UTC] cmb@php.net
In my opion, it wouldn't make sense to introduce this syntax only
for namespace and use statements, but not for the general case.
The latter, however, would introduce several issues, e.g. that
someone might want to construct a qualified identifier dynamically
what would raise performance issues, if possible at all.

Anyhow, such a change would require an RFC[1]; therefore I'm
suspending this feature request.

[1] <https://wiki.php.net/rfc/howto>
 [2016-10-25 15:26 UTC] cmb@php.net
-Summary: Proporse new namespace separator: dot inside a string +Summary: Propose new namespace separator: dot inside a string
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 04:01:29 2024 UTC