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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
38 + 46 = ?
Subscribe to this entry?

 
 [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-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 19 07:05:44 2022 UTC