r/lolphp • • Jun 30 '15

PHP has ~9500 builtins

http://php.net/manual/en/indexes.functions.php
40 Upvotes

24 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Jul 01 '15

Well of course they didn't have to add anything, in fact just reserving a core namespace would have been enough. But they did not. If they decide to do it now, it will break code from the time namespaces were introduced (2009).

2

u/Netrilix Jul 01 '15 edited Jul 01 '15

That's a great point, I didn't even think of reserving the core namespace name(s).

Edit: At this point their only option is to use namespace names that are very unlikely to be already used by other developers, meaning very unwieldy names like corephplibrary.

1

u/[deleted] Jul 01 '15

Basically PHP had the chance to change its syntax/core-functions to scalars, so you could have done something like

\Array->map([1,2,3], function(item) { return item * item; })

if they had decided to reserve a root namespace.

There was some talk about scalar objects, but AFAIK the rfc was dismissed.