Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68579 invoked from network); 7 Aug 2016 11:19:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Aug 2016 11:19:39 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.213.49 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.213.49 mail-vk0-f49.google.com Received: from [209.85.213.49] ([209.85.213.49:35603] helo=mail-vk0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/60-33134-A4917A75 for ; Sun, 07 Aug 2016 07:19:39 -0400 Received: by mail-vk0-f49.google.com with SMTP id w127so221611526vkh.2 for ; Sun, 07 Aug 2016 04:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=eQp66o/uXvA7DIRs/b/3IIuwZzAzd0xf5W/IQ0ZHPn4=; b=aZiyhJQPs7zVtiQIskBdvbrY4X4tHpoMe4o0o1viyHza+guzDe/ScSPB+zvB6a17pd /fnTHVMOUncXYqZBh8ZgTA+UHjWri4xd4EW9qwGfySuwnQ2EFMi1Ox7NGtctsaqmpbym Jl/uk/9xWffyP6lEHvqbgLFv6nwpP4mHG/nByMTElkmsCMj1D+H7wdZHewLARS4dFgeF D7X7dl/zaM4M+DYr4PBZuY9JKTdiiSqZuHb8Cy9jPAZ4W+bE4276iGA/5BfFuRCA8WXx IX+rHfzpNnvTG9Y9aYH0J6wfseHBySZnT2Nghi8slmTQrp5RcIkBMyiKexN/zcWAzoGP bspg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=eQp66o/uXvA7DIRs/b/3IIuwZzAzd0xf5W/IQ0ZHPn4=; b=YrRqZOd0P0M87fBT5tIDp2R3FkeYVWjhJpFnN5wKx74MW1k/CVcabxlCelOOAHfp0m 8WpT+RUUlt7Hhd0jR/zqVUvUH6oWdbECuTyusk9rC7KQCmC2IEnsA0E7BBsTO6uzSpWG oWe2qkYi+xNM5Adhe2e01UGsCuADImBDUaKUkGXHiwmdvQ1uoTaKMzZ+tEpqF36UnLf4 rEkG2XrPcZk1FFF+vxCwLnI9/ikmGTbRDrCUM2i6WbXrF+PAnU5wHXKVgJkdPG5ukWCa U41FULet+8E4VVXZO4Migi7FzlUb1rxJ2AInYVHy1ggv5OpXwhEumG/DEGC2pD4cd8oE tZ8Q== X-Gm-Message-State: AEkoouuDvGh85QMVUNquH6Y294w9zZyjaVJyOp+UlZiLlXbO2Vf6zDFia1pN0EUrsBzymi6TW5KLVkCEZRg55w== X-Received: by 10.31.95.137 with SMTP id t131mr10834373vkb.67.1470568776137; Sun, 07 Aug 2016 04:19:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.153.195 with HTTP; Sun, 7 Aug 2016 04:19:35 -0700 (PDT) Date: Sun, 7 Aug 2016 13:19:35 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a114e3cae854ceb053979797a Subject: Function auto-loading From: rasmus@mindplay.dk (Rasmus Schultz) --001a114e3cae854ceb053979797a Content-Type: text/plain; charset=UTF-8 I'd really like to see the function auto-loading proposal revived and/or possibly simplified. The fact that functions are hard (in some cases impossible) to reach by manually issuing require/include statements is, in my opinion, half the difficulty, and a much more deeply rooted language problem exacerbating what should be trivial problems - e.g. install a Composer package, import (use) and call the functions. Looks like a fair amount of work and discussion was done in 2013 on this RFC: https://wiki.php.net/rfc/function_autoloading There was a (now stale) proof of concept implementation for the parent RFC as well: https://wiki.php.net/rfc/function_autoloading2 What happened? It looks like the discussion stalled mostly over some concerns, including reservations about performance, which were already disproved? One issue apparently was left unaddressed, that of whether a call to an undefined function should generate an auto-load call to a namespaced or global function - I think this would not be difficult to address: trigger auto-loading of the namespaced function first, check if it was loaded, and if not, trigger auto-loading of the global function. Most likely a PSR along with Composer auto-loading features will favor a best practice of shipping packages with namespaced functions only, so the performance implications of checking twice would be negligible in practice. Being basically unable to ship or consume purely functional packages leaves the functional side of the language largely an unused historical artifact, which is sad. Keeping things functional and stateless often lead to more predictable and obvious code - I think the absence of good support for functions encourages a lot of over-engineering, e.g. developers automatically making everything a class, not as a design choice, for the sole reason of being able to ship and reuse what should be simple functions. This RFC looks pretty solid to me. What will it take to get this rolling again? --001a114e3cae854ceb053979797a--