Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119911 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71029 invoked from network); 11 Apr 2023 12:21:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Apr 2023 12:21:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1781418054C for ; Tue, 11 Apr 2023 05:21:10 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS20857 136.144.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from outbound5.mail.transip.nl (outbound5.mail.transip.nl [136.144.136.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Apr 2023 05:21:09 -0700 (PDT) Received: from submission13.mail.transip.nl (unknown [10.103.8.164]) by outbound5.mail.transip.nl (Postfix) with ESMTP id 4PwlLW5TybzHTxC for ; Tue, 11 Apr 2023 14:21:07 +0200 (CEST) Received: from [IPV6:2a02:a450:3eae:1:25b4:5401:9820:5290] (2a02-a450-3eae-1-25b4-5401-9820-5290.fixed6.kpn.net [IPv6:2a02:a450:3eae:1:25b4:5401:9820:5290]) by submission13.mail.transip.nl (Postfix) with ESMTPA id 4PwlLV2zrQz1y2d for ; Tue, 11 Apr 2023 14:21:06 +0200 (CEST) Message-ID: <65286b1d-3a27-06bb-191a-96250ddb83ac@demon-angel.eu> Date: Tue, 11 Apr 2023 14:21:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Content-Language: nl To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: ClueGetter at submission13.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=demon-angel.eu; t=1681215666; h=from:subject:to: references:in-reply-to:date:mime-version:content-type; bh=cvprWu287RQYMaDk/f9VS2stH3+FgFP6HDzbbRn8L6A=; b=BW12mTh+4Dq+hsU4lBPSbRGM6iWsYthdas8fEeTGgcQA6gfgPWcm4omCq0wkilFypDrs0k fEgR13npEf7wFy14KRFlbx8TwZ0E6VEyze9GLBsGuwDsD1Hy6+r0F6eDIo1RpN5R6PAzhu ZtyaGO/fiRgFjVzbpVF+3whkM+6hottc6MdxSnez0nh8P3NDvCPqDvtRowVG2rlGSjYJlr c961eRcXDvNIL8ph0th4/Ht0NQtz9+1tqg6uoVoWD/7CQlCpm7Uun4IbDtkN8VamKRshq7 kbpFYx5mrhtGxWGzVIMYuav5qDpzZRdYBHLWIRir3FFMvD92YzduNB2YyemBZA== X-Report-Abuse-To: abuse@transip.nl Subject: Re: [PHP-DEV] [RFC] New core autoloading mechanism with support for function autoloading From: mark@demon-angel.eu (Mark Baker) On 10/04/2023 14:17, G. P. B. wrote: > Dan and I would like to propose a new core autoloading mechanism that fixes > some minor design issues with the current class autoloading mechanism and > introduce a brand-new function autoloading mechanism: > https://wiki.php.net/rfc/core-autoloading > > The existing SPL autoloading functions would become aliases to the new Core > ones and will continue to work without any migrations needing to be > performed. I fully support this endeavour: I've wanted this for such a long time now. A while ago I was pressured into splitting two of my libraries that provided both function and class/method calls, increasing my maintenance workload. This would allow me to combine them again. Looking at all the points that have already been raised, I think Sara sums up well. I also like Rowan's suggestion of a list of namespace prefixes. In particular, you're already considering the use of maps for even better performance, and Constant and Stream autoloading, as possible future enhancements. Constants in particular is something I'd find particularly useful; and my only concern with this is the increased number of functions compared with a single function that accepts a Type argument (as Aleksander suggests). A couple of general questions: Are there any core functions that should never by overloaded (function_exists() perhaps)? We have the special constants like \MyNamespace\MyClass::class. Would you envisage (or is there value in) equivalent constants like \MyNamespace\MyFunction::function? If there is value, how would that tie in with referencing them as Callables in callback functions? -- Mark Baker