News for hackers. Stuff that matters.
Re:PHP: The Right Way by ainsomni on Sunday July 08, 2012 @04:57AM (#4214127)
Using '\' as a namespace seperator? Just off the top of my head, there are probably loads more.
Re:PHP: The Right Way by TheBoff on Sunday July 08, 2012 @06:03AM (#4214225)
What makes that explicitly bad?
Re:PHP: The Right Way by wvenable on Sunday July 08, 2012 @12:15PM (#4214893)
I've actually gotten used to it (and I rallied against it heavily). It's really not so bad; it's even somewhat nice it has a file-system like connotation. PHP's design precluded using any existing operators.
Re:PHP: The Right Way by swivelmaster on Sunday July 08, 2012 @06:01PM (#4215869)
Based on how long it took to introduce the ability to say foo()["bar"], I'm guessing it's not the language so much as it's a set of poorly designed parser rules.

Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result);

Re:PHP: The Right Way by wvenable on Sunday July 08, 2012 @06:36PM (#4215944)
> I'm guessing it's not the language so much as it's a set of poorly designed parser rules.

There are poorly designed parser rules but the namespace operator is not due to that. It's due to the fact that a single PHP file will be compiled to byte code without knowing what the symbols represent until runtime. The separate operator is needed because names are resolved before execution begins and before the symbols are known.

> Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result);

Empty is identical to the not (!) operator except that empty() can operate on undefined variables, undefinted array keys, or undefined properties. empty(functionResult()) doesn't make any sense because functionResult() can never be an undefined variable. You just use !functionResult().