4 ms·
Because the language already has :: copied from C++. But rather than continuing to use :: for both namespaces and static class access, exactly like it's done i
by wvenable 18y ago
Because the language already has :: copied from C++. But rather than continuing to use :: for both namespaces and static class access, exactly like it's done in C++, they added yet another operator. To solve a problem that doesn't exist.
So rather than simplifying the language, they're making it more complicated (especially by choosing the escape character). It's just dumb.
- jrockway 18y agoWell, to be fair to the implementors, using \ makes the parser slightly easier to implement. Good languages (and libraries) are willing to make implementation harder if it makes the code easier for the user to write. But this is PHP. You seem surprised.
- asnyder 18y agoIf you put it that way, then I would have to agree. But I don't think I would go so far as to fork the language to correct the issue as was suggested above.
- nir 18y agoAlso, it's just bad taste. It's plain ugly. I wish someone would write a PHP parser with a Ruby-like syntax. Obviously the more powerful features of Ruby would still be missing, but just having a more readable syntax would be a nice improvement.