Nicolas, On Sun, Sep 1, 2013 at 11:27 AM, Nicolas Grekas < nicolas.grekas+...@gmail.com> wrote:
> My previous message didn't push the point I wanted raise: don't we have a > major problem related to at-run-time namespace resolution for functions and > constants? > > Take this code: namespace foo { strlen("bar"); } > > Will you trigger an autoload for foo\strlen? > I believe not because that would hurt performance too much. > But then, how will you load function foo\strlen if it exists? > > Now take this code: namespace foo { bar(); } > > Will you trigger autoload for "foo\bar" first, then for "bar"? > Only for "foo\bar"? But then, what if "bar" exists and just waits being > autoloaded? > > I fail to see how autoloading functions is compatible with at-run-time > namespace resolution. > So, here's how it works, by example: namespace foo { use function biz\buz; use foo\bar; something(); // autoloaded as "something" buz(); // autoloaded as "biz\buz" bar\baz(); // autoloaded as "foo\bar\baz" \load\execute(); // autoloaded as "load\execute" } So basically, if the call uses "fallback" resolution, the autoload is only attempted at the global resolution. Does that make sense? Anthony