Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125115 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 47C501A00BD for ; Fri, 23 Aug 2024 09:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724407214; bh=Rn8gPIjBTdrQ6h3SQ2YIWlg4lCcJLflxzZJGj0ixjyo=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=F/bclaHqHjWXH+6bP84VjaQVqac5/H72QI893JsUQUUn/easJbA+qYGCnjQOtPhUx mWoVjhu8sgyWuUP8yr+oSSpvYp4e8fKKFCx8zCMsgaFnqxjK9tADjiAsoIHa7iaxFU 9qpvfdY41Gm0Crszq5o+UdFxMKFEiN0YnZYLm06EFjn5EDg75X6Vi8MeYgKmxCchMP BTbmglqrSEvoAr6ozQBFZD8vlKVr7LsmfBAzs0p40hDhNUgUS1v+delQUabSZ0L93U RIp7YxWZUo56+WZKe5vx0NBWvcFpR1/07wRQlTYA4RRD9NhkrqTXnFqg5Ni+9Tl0io JGx0oJ0NwlxPQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0B6B180042 for ; Fri, 23 Aug 2024 10:00:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (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 ; Fri, 23 Aug 2024 10:00:13 +0000 (UTC) Received: from smtpclient.apple (ppp-27-55-92-248.revip3.asianet.co.th [27.55.92.248]) by mail1.25mail.st (Postfix) with ESMTPSA id 2E66C60404; Fri, 23 Aug 2024 09:58:16 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) Date: Fri, 23 Aug 2024 16:58:02 +0700 Message-ID: <53BD062A-4D7F-4E5D-852E-6D27641213A8@koalephant.com> References: <21D6F160-5EAE-44FA-907B-E1DAAC1B8D75@rwec.co.uk> Cc: internals@lists.php.net In-Reply-To: <21D6F160-5EAE-44FA-907B-E1DAAC1B8D75@rwec.co.uk> To: "Rowan Tommins [IMSoP]" X-Mailer: iPhone Mail (21F90) From: php-lists@koalephant.com (Stephen Reay) > On 23 Aug 2024, at 15:29, Rowan Tommins [IMSoP] wro= te: >=20 > having global as the default mode (even if we provide an option for local)= is much less disruptive to existing code. Hi Rowan, I don't disagree with this summary of the current state, but I think this mi= sses an important factor: namespaced functions are currently nowhere near as= popular as namespaced classes, and a significant part of that is almost cer= tainly because we don't have function autoloading, nor any kind of visibilit= y controls for functions (eg package private). Making relative function names do the opposite of relative class names sound= s like a great way to permanently kill any prospects of encouraging develope= rs to use regular namespaced functions in place of static classes as "bag of= functions", which is what we keep hearing we should use - most notably on a= recent RFC to embody the concept of a static class. So we're told "no don't use classes for static functions like that, use prop= er functions". We already can't autoload them which makes them less appealing, and less pra= ctical.=20 In a world where global functions take precedence over local ones because so= me people don't like writing a single \ character, autoloading would be a mo= ot point because if you preference global functions you're implicitly tellin= g developers they shouldn't write namespaced functions, by making them harde= r and less intuitive to use. Cheers Stephen=20=