Hi!

> So what your saying, if I understand you correctly, is that PHP was
> intentionally designed to be non-deterministic? And it was designed that
> way to save a single character?

It is deterministic, there are rules for it, described in
http://us1.php.net/manual/en/language.namespaces.fallback.php. And it's
not to save single character, it is to save single character on hundreds
of thousands of function calls which otherwise all would have to be
rewritten. It's to prevent namespacing a code piece being equal to
rewriting every function call in it and making it extremely ugly on the
way.
The cost of if is that yes, if you want to override strlen (which still
escapes me why would you ever want to do something like that) you need
to load it first so the engine knows about it and resolves it correctly.
I think it is a very small cost compared to rewriting and uglifying all
your code.
It was all extensively and meticulously discussed on the list when
namespaces were designed. It is a real waste of time to repeat those
discussions now.

> It's only "try namespace, then global" in the case where there's no `\`
> in the function name. Compile code that does the
> check: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_compile.c#1938

I know. That you for pointing me to the code I wrote. I am sorry that I
didn't just copy-paste the whole "namespace resolution rules" section, I
though it is clear from the context that I am talking about
non-fully-qualified names.

> PS: I think it's ironic talking about internal consistency of a language
> in the same reply where you justify "try namespace, then global" as a
> good design feature. Just pointing that out...

It is a good design feature, and there are very good reasons for it.
Unless, of course, you think prepending every internal function and PHP
constant in all the existing code in PHP with \ would be better. In
which case we have very different ideas about what good design is and
would never come to any agreement on that.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to