News for hackers. Stuff that matters.
Re:PHP 7.1.0 Released by koenigdavidmj on Friday December 02, 2016 @01:51AM (#13086684)
Last I heard, PHP's lexer and parser do not do well with ambiguity. This is why namespaces use backslash as their separator (since dot and double colon were already taken).

Question mark never appeared directly after colon before this, so the second syntax is not ambiguous. The first one would be understood as part of a ternary operator, followed by choking on the start of a block.

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.

Re:PHP 7.1.0 Released by chris_wot on Friday December 02, 2016 @06:49AM (#13087851)
Should a lexxer and parser "do well" with amiguity ever? I'm not sure I can think of a single one that handles insanely convoluted and ambiguous stuff well at all...