Hi!

> Having the use statement trigger the auto-loader would result in a lot
> of broken code because of optional dependencies (remember the examples I
> showed you in the annotation thread).

I think it's not a good idea in general. use statement right now is
basically a syntax sugar - you just change interpretation of names. But
you don't cause anything to load by this statement. Changing it would
mean people have to change a lot of assumptions about what is loaded
when. E.g., there's a lot of code which use's classes and spaces that
may not even exist - just because they *might* exist in some scenarios,
and will be used in those scenarios, further down in the code.

I don't think completely changing the semantics of a very widely used
statement is anything we should be doing.

> This would make it even more painful for users to define anything in the
> global namespace; a good thing.

No it's not. Why should it be a good thing?

> It would however encourage people to prefix their stuff inline with a
> backslash, otherwise you end up with an endless use chain for every

I'm sorry but this is horrible. PHP code should not look like a fence of
backslashes, backslashes do not have any useful function there and in
99.9999% of cases global functions *are* global functions, and nobody is
overriding them. Yes, you can override strlen. No, nobody (within
0.00001% accuracy) does.

> built-in feature which is not nice. That being said, it's required
> anyways if we are really going to introduce namespaces for everything
> within PHP (e.g. `use function php\random_bytes;`). Something I still
> think is a bad idea at least for procedural first-level functions.

It's a bad idea for all existing functions and classes. Because it adds
complications for people without giving them anything in exchange.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to