Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54199 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64554 invoked from network); 26 Jul 2011 08:40:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2011 08:40:05 -0000 Authentication-Results: pb1.pair.com header.from=sebastian.krebs.berlin@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=sebastian.krebs.berlin@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.215.173 as permitted sender) X-PHP-List-Original-Sender: sebastian.krebs.berlin@googlemail.com X-Host-Fingerprint: 209.85.215.173 mail-ey0-f173.google.com Received: from [209.85.215.173] ([209.85.215.173:60066] helo=mail-ey0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/D1-48186-36D7E2E4 for ; Tue, 26 Jul 2011 04:40:04 -0400 Received: by eyb7 with SMTP id 7so299494eyb.4 for ; Tue, 26 Jul 2011 01:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=3pHC+UU8VK4fwSMpj0mNKYrgG1rIO4KOU6Wmz2B6Tyc=; b=k2dgN/IT6pwDdfVdacfdT+ODZBXv5w8hpzjRUcVbk55BClpE71axZo9iIFZ28N5ShW gnWyFLdSQK/nkxphEC/L8mVTTQgTz+e0aW6kTQUdTRG0pxox5CfYcRsjFiDjUjMQmsuc WcI45r0NkOfhzNMkF4hzZD50YT/KCJLTBUDDw= Received: by 10.204.144.198 with SMTP id a6mr1449811bkv.87.1311669600843; Tue, 26 Jul 2011 01:40:00 -0700 (PDT) Received: from [192.168.24.2] (91-64-205-130-dynip.superkabel.de [91.64.205.130]) by mx.google.com with ESMTPS id i1sm89479bku.54.2011.07.26.01.40.00 (version=SSLv3 cipher=OTHER); Tue, 26 Jul 2011 01:40:00 -0700 (PDT) Message-ID: <4E2E7D5F.9090908@googlemail.com> Date: Tue, 26 Jul 2011 10:39:59 +0200 Reply-To: sebastian.krebs.berlin@googlemail.com User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: PHP internals list References: <4E2E784F.4050307@googlemail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Function/Constant autoloading From: sebastian.krebs.berlin@googlemail.com (Sebastian Krebs) Hi, thanks for your reply, but I'm not talking about class loading (because thats already possible). I'm talking about autoloading of userspace functions and constants // /path/to/my/functions.php namespace my\functions; const THING = 'I am constant!'; function helloWorld () { echo "hello World; } // /path/to/some/other/file.php namespace foo; use my\functions; functions\helloWorld(); // fail! echo functions\THING; Am 26.07.2011 10:27, schrieb 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 => > /path/to/project/lib/vendor/Doctrine/Common/IsolatedClassLoader.php > > \namespace\package\Class_Name => > /path/to/project/lib/vendor/namespace/package/Class/Name.php > > \namespace\package_name\Class_Name => > /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 don'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 the >> developers-side anyway. >> >> Sebastian Krebs >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > >