Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67278 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51919 invoked from network); 2 May 2013 22:18:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 May 2013 22:18:34 -0000 Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:37592] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/A2-37535-836E2815 for ; Thu, 02 May 2013 18:18:33 -0400 Received: by mail-wi0-f171.google.com with SMTP id l13so87794wie.10 for ; Thu, 02 May 2013 15:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=+xfHVlJR5QyBTTGMLl1snwQRQ8IH8VZugMy8dv4NycY=; b=SWpL5UmDJmiQWql3Lg5taJ9j/Om6YtxKVQTuFWl2KP8YRE1xSlTaR046z2ngNUMExw 0/l+OOEugUtsVz63jt99S3RW9WqWkrENLNaSp/eetiWW0K0E8m5a5UlEZFSMH3TsjBT9 86K8Jq8rSjyI/7n7aeROQAUSxVjI2k+cUwZfHA/+VllGoQ6JlKNaH0TrBQa59ZPjz52d W2PCWAyhG4+gFKkxBv7DgYcP99VlLoH6DfdQkrFS51seOIClEWVrjUi/qSdwT2fpZmU3 gXZTVY+gF0eu+FbGrDcuJizb2e1HH4RxRCLz4GvMioYdu2gbxOp1EHID+J7Bm0hCJyqf 3Pgw== X-Received: by 10.180.13.166 with SMTP id i6mr37481837wic.21.1367533109635; Thu, 02 May 2013 15:18:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.79.142 with HTTP; Thu, 2 May 2013 15:18:09 -0700 (PDT) In-Reply-To: <4A468FA3-3260-463C-9D4E-FA78736447C1@wiedler.ch> References: <94D5D345-4D14-4BFF-9650-15E80205A6DE@wiedler.ch> <4A468FA3-3260-463C-9D4E-FA78736447C1@wiedler.ch> Date: Fri, 3 May 2013 00:18:09 +0200 Message-ID: To: Igor Wiedler Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c243ce38204904dbc39d6a Subject: Re: [PHP-DEV] Re: Importing namespaced functions From: krebs.seb@gmail.com (Sebastian Krebs) --001a11c243ce38204904dbc39d6a Content-Type: text/plain; charset=ISO-8859-1 2013/5/2 Igor Wiedler > No, I want to keep autoloading out of this proposal. It is way beyond the > scope of the namespacing issue and also incredibly complex. > > That said, this RFC may be useful for implementing autoloading in the > future, as it addresses one of the things that makes function autoloading > hard, which is being able to distinguish between namespaced and global > function calls. But that's only one piece of the puzzle. > Well, it is not as complex as it sounds This is the behaviour right now - Does X exists as namespaced function (current namespace or imported)? - Does X exists as global (builtin) function? - Trigger error The behaviour including autoloading would be more like - Does X exists as namespaced function (current namespace or imported)? - Does X exists as global (builtin) function? - Trigger autoload - Does X exists as namespaced function (current namespace or imported) now? - Maybe: Does X exists as global function now? - Trigger error The autoloading itself could use parts already used for class-autoloading. // Signature // spl_autoload_register($callback[, $type = AUTOLOAD_CLASS]); $autoload = function ($name, $type = AUTOLOAD_CLASS) { // Do something }; spl_autoload_register($autoload, AUTOLOAD_CLASS | AUTOLOAD_FUNCTION | AUTOLOAD_CONSTANT); // "constant" here just to make it complete Namespaced functions without autoloading seems kindof incomplete, especially because it isn't such a big deal to simply use the prefixed one, so the benefit seems quite small to me :X use MyFoo\Bar\MathFunctions as math; $x = math\sin($y); Just saying :) Regards, Sebastian > > On May 2, 2013, at 11:40 PM, Sebastian Krebs wrote: > > > Hi, > > > > Are you going to cover autoloading of functions too? > > > > Regards, > > Sebastian > -- github.com/KingCrunch --001a11c243ce38204904dbc39d6a--