5 ms·
They couldn’t use forward slash, as it is the divide operator. They couldn’t use a period, like python or java, because they use it as the concatenation opera
by rajbot 5y ago
They couldn’t use forward slash, as it is the divide operator.
They couldn’t use a period, like python or java, because they use it as the concatenation operator.
- captainmuon 5y agoCan you have a namespace with the same name as a local variable? If not, then they could have used `/`. Of course then you cannot know what an expression means without executing the program, but I'd assume they already have a few cases in there (with variable variables and so on; it's bin a while since I've used PHP productively). It would also have been possible to just reuse `->`, then namespaces look a lot like static objects. Or the double colon `::` which was already used in some contexts.
- tored 5y agoPHP 8 changed how the parsing of namespaces work, instead of multiple tokens it is just one. https://wiki.php.net/rfc/namespaced_names_as_token https://wiki.php.net/rfc/namespaced_names_as_token I wonder with this change it would be theoretically possible to have any character as a namespace separator.
- readonthegoapp 5y agoi see how using the forward slash could have presented problems, but it doesn't seem to be a problem for other languages, so... i guess part of what really strikes me about it is...it's a _back_slash. like...something Bill Gates would approve of. backslashes are not open source-y or unix-y or linux-y. the 'history of php' shows this snippet: <!--include /text/header.html--> which, to me, just indicates that PHP has been comfortable with forward slashes in all sorts of contexts for a long time, it was built to resemble-ish C, etc. etc. i thought one of the folks making the decision might have been like: Backslash? Nah. Everyone has their hangups -- right now, mine is: OK, I'm gonna use Laravel. I'm gonna use the starter kits, they're free, PHP is doing fine, much better than Python actually/probably, it's prob 1,000x faster than Python, Python still doesn't know what version it wants to be and will prob never get to another version anyways, but... can I really look at those PHP backslashes?? No. No, I can't. I'm using python/django instead. ... We'll see. I've been thinking about this for months. I figure in a few more months I'll figure out how to disqualify python/django.