Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86878 invoked from network); 1 Sep 2013 20:30:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2013 20:30:24 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:61610] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/D6-55332-FD3A3225 for ; Sun, 01 Sep 2013 16:30:24 -0400 Received: by mail-vc0-f171.google.com with SMTP id ij15so2488449vcb.2 for ; Sun, 01 Sep 2013 13:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Z6apBWttyvcRNZBLBdP8WKxKj4tQkpdnjN0cju4prGM=; b=ZannznE9xHIJ+AthzqceEFNRbqtgbe7BaXS7OS3KRYcEhIvQDu+1YbRWBgfjPWqCd0 Rk1eRgAfkVIRqROZuDz1IwTe8MtAdt6joODSt7r97OWEhnhzArKxQAoacjAxi+FrIpVN wCTlKHBDAC02zK9dIDY9x9pM0fElR48tf8sTomDiOcmcRBcKiX7UJX9kV3WaPdz8NdTn yd8VfN+KYr2nuOhW/JNUcG1TO+NmYJpSB4Y4kR7Wzm1gl7XJFZKl/0OD2CR3tADTge9e gaxw+WpVz97Gsrz1URsGuyr07lmJPJmZWYeNRS2AuFwdLvBDJ+8wYbLC7lWhyaMBEE9R IdnQ== MIME-Version: 1.0 X-Received: by 10.52.114.65 with SMTP id je1mr6436623vdb.10.1378067418237; Sun, 01 Sep 2013 13:30:18 -0700 (PDT) Received: by 10.58.94.201 with HTTP; Sun, 1 Sep 2013 13:30:18 -0700 (PDT) In-Reply-To: References: <5220262A.6040702@sugarcrm.com> <5220437A.7050008@sugarcrm.com> <5220D212.3010101@sugarcrm.com> <61FCD6C4A31248078FEAD2BA73D7CD44@gmail.com> <7AF31CC1D1554454AC95AE758D23E92E@gmail.com> Date: Sun, 1 Sep 2013 16:30:18 -0400 Message-ID: To: Nicolas Grekas Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec548a929f0d21504e55852df Subject: Re: [PHP-DEV] Re: Function autoloading From: ircmaxell@gmail.com (Anthony Ferrara) --bcaec548a929f0d21504e55852df Content-Type: text/plain; charset=ISO-8859-1 Nicolas, On Sun, Sep 1, 2013 at 11:27 AM, Nicolas Grekas < nicolas.grekas+php@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 --bcaec548a929f0d21504e55852df--