News for hackers. Stuff that matters.
Re:PHP 7.1.0 Released by TazeTSchnitzel on Friday December 02, 2016 @09:13AM (#13088641)
In PHP, variables, functions, constants and classes are all completely separate namespaces, and likewise methods, properties and static properties are separate namespaces.

Reusing :: for namespaces would complicate this. Is foo::bar a class constant or a namespaced constant? Do we autoload src/foo.php or src/foo/bar.php? If I do `new foobar::qux`, is foobar::qux a class, a class constant containing a class name, or a namespaced constant containing a class name? Do we autoload src/foobar.php or src/foobar/qux.php?

It's not like the lexer or parser could magically solve this. The way the language is designed, there is inherent ambiguity here.

In some other languages, there is a unified symbol table, so you don't have this problem. But PHP doesn't have that.

There are no comments on this comment yet.