Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94554 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75910 invoked from network); 18 Jul 2016 15:33:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2016 15:33:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=michal.brzuchalski@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=michal.brzuchalski@gmail.com; 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: michal.brzuchalski@gmail.com X-Host-Fingerprint: 209.85.220.171 mail-qk0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:33748] helo=mail-qk0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/D2-52781-F00FC875 for ; Mon, 18 Jul 2016 11:04:47 -0400 Received: by mail-qk0-f171.google.com with SMTP id p74so159499511qka.0 for ; Mon, 18 Jul 2016 08:04:47 -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; bh=ABIPSMT1eVzu4zayN93WjehKD3Du5IdREaf+ZGpPx/0=; b=iAW8Gj5XThCkHglkha8W/qurHhNeMPxPnK2G2uuCFbqeII+xg1j9+8a8CScxAHdvi8 pPY2LFGqOICTMxO2AJuya4v1aAxr+70A58F3DS2hQ/mrnVUyNFGCXlWfWSnAYBE0lTGz 1VZDwh+eDU2qPGrUzzD3i7Vw6Vl46noGZ6EiIKoMHT/Gb9e7vAUc0niYMPJ3aD/kliW1 TxQGDP2vEBguaCFcIhgtuD3ap8LVe4TwaZD1/tMsHbNNFD2h3F4UaqGogT8fIkK7AKhN GLF6qTMMxvS+AxP0t641K2OieSWMZe/a8uSMFeXHZEB9I8ZcaqPpeKo5kxOuyjT9eu/G TY4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ABIPSMT1eVzu4zayN93WjehKD3Du5IdREaf+ZGpPx/0=; b=X80Zq8yG6uOUV015YZh00W1xfVyrV9SwbU5TdSUj/Uu8etWMKvUCebOEgW2f8HG7sW lKuQgBAI1vbE++J9fg5+ngUeUPC3uWKCHUu4E1bzXqR2wswwD7bdhebGsQ90AqZWnbdt Wqcvqu3etol29vV31RsXI3Ue9hTAs9ePR699ohzdiQfduaAGkxnKCmc4Vlb9jNiEtmOl c6t3sDbujKme0s6N3LcWbFG1I3WNwPJlN5l2nYYxHMB649IIKJVL3x1hMCwKizapggf/ 1968eWoa7dD3HKz5BBIGdBG+I/4ZnXizfI8Su4GolvFpmQdso8DG9auY7nlPOvGHpx+h f+cQ== X-Gm-Message-State: ALyK8tLQSkfN44gRaOr3iTdDoFkOrAvxhy+CAEsaXs19TyLnmOjcHo9k2J9craerIB+IOf4falgK9W6D09ec5A== MIME-Version: 1.0 X-Received: by 10.55.158.18 with SMTP id h18mr43134236qke.161.1468854284802; Mon, 18 Jul 2016 08:04:44 -0700 (PDT) Received: by 10.237.53.155 with HTTP; Mon, 18 Jul 2016 08:04:44 -0700 (PDT) Received: by 10.237.53.155 with HTTP; Mon, 18 Jul 2016 08:04:44 -0700 (PDT) In-Reply-To: References: <3567286a-e942-1551-c300-663a50b0f484@gmail.com> Date: Mon, 18 Jul 2016 17:04:44 +0200 Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary=94eb2c06d756df65d30537ea4997 Subject: Re: [PHP-DEV] Idea: Function autoloading using dummy namespaces From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --94eb2c06d756df65d30537ea4997 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 18 lip 2016 15:58 "Rowan Collins" napisa=C5=82(a)= : > > On 18/07/2016 01:50, Stanislav Malyshev wrote: >> >> Hi! >> >>> How about an alternative approach where a function inside a namespace >>> can be autoloaded using the existing callback, by using a reserved >>> namespace segment? So to autoload function "foo\bar()", the engine woul= d >>> construct a string like "__function\foo\bar" or "foo\__function\bar", >>> and pass that to the registered autoloader stack. >> I was thinking on passing some context information into autoload about context, eg.: class | funtion. Wouldn't it be satisfiable information for autoloader? IMHO it would be the easiest way to satisfy autoloader to find proprietary implementation. Such problem as naming convention of functions file could be resolved in userland! Without complex implementation in core. >> >> Magic out-of-domain values usually are bad design, and lead to a lot of >> trouble since now the system needs to deal with two sets of assumptions >> instead of one. I wouldn't recommend doing it. >> > > Hi Stas, > > My original idea was actually to have the autoloader look up "foo\bar\__functions" for *any* function in namespace "foo\bar", with the idea that some existing autoloaders would actually be able to work without any modification (just call your file "__functions.php"). > > If you include the function name (to give users more flexibility), that doesn't really work (unless you have one function per file), so you're right that it requires some muddling assumptions. > > I agree that it's all a bit magic either way, but I thought it might get the feature moving quicker than a complete rewrite of the existing autoload system. > > Like I say, it was just an idea. :) > > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --94eb2c06d756df65d30537ea4997--