Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54577 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68025 invoked from network); 14 Aug 2011 12:59:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 12:59:49 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:39268] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/32-50938-3C6C74E4 for ; Sun, 14 Aug 2011 08:59:47 -0400 Received: by yxk30 with SMTP id 30so3154703yxk.29 for ; Sun, 14 Aug 2011 05:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=EDbVRlGRlII3qfSFwNzcERq75ljhGxFkc/+Gk88nOj4=; b=UfsQr0xW5k+Wvcj7KWjLYBfRYmE0pEZbgH5WBtgRHdz/l2z397O+aJ19+ef0ArmgI7 MeEPU4R49eSQhIxxhVk6bTPChU7XF6naf/rfMrqIJFpMMttpGx8g4uAqIXE2R4EefWiB SLekBlNvWCpJozPz891a5aUhmOT4UzE/yv+nw= MIME-Version: 1.0 Received: by 10.236.154.42 with SMTP id g30mr2603719yhk.236.1313326784710; Sun, 14 Aug 2011 05:59:44 -0700 (PDT) Received: by 10.146.168.9 with HTTP; Sun, 14 Aug 2011 05:59:44 -0700 (PDT) In-Reply-To: References: <4E3D3275.9020903@rotorised.com> Date: Sun, 14 Aug 2011 14:59:44 +0200 Message-ID: To: Jan Dolecek Cc: Sebastian Krebs , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload* From: tyra3l@gmail.com (Ferenc Kovacs) On Fri, Aug 12, 2011 at 3:54 PM, Jan Dolecek wrote: > Someone said that it won't be that easy, because functions are > searched within a namespace first and when they don't exist there, > then are called from global namespace. > > Example: > namespace example; > echo substr('Test', 1, 1); > > When calling function substr, Zend engine first tries to find function > example\substr. If such function doesn't exist, it tries just substr > which is found and called. Thanks to this lookup, we don't need to > escape all function calls with backslash prefix. > > echo not_found(1); > When trying to autoload a function, which one should be auto loaded? > "example\not_found" or "not_found"? first example\not_found then \not_found if necessary. > > > > Similar situation is with constants, because of BC a non-existing > constant must result in string with the same value as constant's name. > var_dump(MY_CONSTANT); // string(11) "MY_CONSTANT" > > Some programmes rely on it (though it's not recommended) and calling > autoloader everytime would add significant load to such apps. > the autoloader shouldn't affect this, if no const is found, then the constname should be used. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu