Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54197 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61162 invoked from network); 26 Jul 2011 08:34:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2011 08:34:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:56207] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/21-48186-E0C7E2E4 for ; Tue, 26 Jul 2011 04:34:23 -0400 Received: by vwl1 with SMTP id 1so147759vwl.29 for ; Tue, 26 Jul 2011 01:34:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GI+DibNRvPaNb46R8TP5eCWGd64/SA5pyXsMHfJdwsI=; b=p9266OLjwOBz66s41l1FUwu8g45DcH+vxgkyVxUf+DlMgGP04pbYI8rMGUef1QtJUE rkToAW3zfntDoLvDiN9PW3F0sv7dwjxSNi/nc39oiEmEUxTo34QSWkykmOgMKrVrrUWK p9BoPKCu/oWzvHSjTl1qyj6XbS3WotZQ5G0jA= MIME-Version: 1.0 Received: by 10.52.90.4 with SMTP id bs4mr2049608vdb.7.1311668873970; Tue, 26 Jul 2011 01:27:53 -0700 (PDT) Sender: laruence@gmail.com Received: by 10.220.161.130 with HTTP; Tue, 26 Jul 2011 01:27:53 -0700 (PDT) In-Reply-To: <4E2E784F.4050307@googlemail.com> References: <4E2E784F.4050307@googlemail.com> Date: Tue, 26 Jul 2011 16:27:53 +0800 X-Google-Sender-Auth: cut_ynsuDjj0W96Vvc0VuZq0IB8 Message-ID: To: sebastian.krebs.berlin@googlemail.com Cc: PHP internals list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Function/Constant autoloading From: laruence@php.net (Laruence) Hi: maybe Yaf_Loader can be used for meet this requirement. it's a internal autoload function: Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system. Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace. The fully-qualified namespace and class is suffixed with ".php" when loading from the file system. As examples: \Doctrine\Common\IsolatedClassLoader =3D> /path/to/project/lib/vendor/Doctrine/Common/IsolatedClassLoader.php \namespace\package\Class_Name =3D> /path/to/project/lib/vendor/namespace/package/Class/Name.php \namespace\package_name\Class_Name =3D> /path/to/project/lib/vendor/namespace/package_name/Class/Name.php http://pecl.php.net/package/Yaf thanks 2011/7/26 Sebastian Krebs : > Hi, > > Maybe this topic occured already, then sorry when I'm wasting your time, = but > I'm wondering, why there is no autoloading for functions and > (namespace)constants. > > When a class is not found, then an userland function is called. Thus I do= n't > see a reason, why something like this doesn't exists for functions and > (namespace)constants too, because using them is quite uncomfortable right > now compared to classes and the decision _how_ to load them would be on t= he > developers-side anyway. > > Sebastian Krebs > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/