Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125114 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 E4AE01A00BD for ; Fri, 23 Aug 2024 09:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724405759; bh=2HvkWI4/KaP6WSqdtpcqWIYat5O5HAF/9LbyuenuzJE=; h=Subject:From:To:Date:In-Reply-To:References:From; b=Vx4gdmcylgwfFjYM4yTTO5SyuFNMZWskemETdv5pbYIQkQ37t3h3T4jzneET/uHHN MxE5+zAOL+Lk1nMZg4wYPaIfPRQgfu7X7yEoRc1mOWjRxA+tWB3WZ9LNOxW1BciVFG vXAbVp4VmHPI30HssUBe9B5ydSUYY7a7YCXeDzIYTsbiUxWvWprEqPePRaFeKjxsbw dBBI+NYJPViPewB/OldibUGnsqR7luGNms9tF2QmY+kNf+sfLBWgiTv3eLxv0ZZ+YJ kYFAO+Z7t918NKJ0/BErmF3rmKyT1Flb7Tp0Is7Mwf7NDi8u3EEzl09wAcWzV7FmNb 29VQcHYRYeKqg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0BCDD180054 for ; Fri, 23 Aug 2024 09:35:59 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from ageofdream.com (ageofdream.com [45.33.21.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Aug 2024 09:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ageofdream.com; s=ageofdream; t=1724405647; bh=2HvkWI4/KaP6WSqdtpcqWIYat5O5HAF/9LbyuenuzJE=; h=Subject:From:To:Date:In-Reply-To:References:From; b=fcaqNGD5R4FbFUjeRaUCwi0Mt1qX0rPDP8/abNgXpxVN7PPdaydLEJfVlxAU7nPc6 68wvJ+t/Q6zAbm5szMvDNK1zauQhTyDYqSmJ3FfliePVhOxlAK712j4mdwR9joJesf WTb3+HNFC1Mdo3hWw6xBjk02V8k4vO2ucN0guMQ/PAxIhWYt+/rPpK/GPsePH4mVo4 /4qWEZTdS/vQcji23tKbAdRzsFrPbALZdlJSTvJMJckfgUmPSuHcePK8BKwoxLUHvR JgtlJDK/7iyckf2ettD5jGTAaQ+2k5cdfklHQOPVKW0yZfYt+YXnrbkLofN8Kc2Cyz xfR8Z9VIybITw== Received: from [192.168.1.7] (unknown [72.255.193.122]) by ageofdream.com (Postfix) with ESMTPSA id 5CCB025095 for ; Fri, 23 Aug 2024 05:34:07 -0400 (EDT) Message-ID: Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: internals@lists.php.net Date: Fri, 23 Aug 2024 05:34:06 -0400 In-Reply-To: References: <846D7756-712B-4A7C-9FC6-DB9F858836B8@rwec.co.uk> <880ffc27dc9b421407a670c75d5f5ba756870396.camel@ageofdream.com> <790534cd-e158-4712-878c-642dfd0e2bad@app.fastmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 From: lists@ageofdream.com (Nick Lockheart) > >=20 > >=20 > > A third option, which I haven't seen come up on the list yet, is > > that > > unqualified functions that are PHP built-ins are treated as global, > > and > > using a function having the same name as a built-in, in a namespace > > scope, requires a fully qualified name to override the built-in. > >=20 > > It seems that if someone is writing `array_key_exists()` or similar > > they probably mean the built-in function, and in the rare cases > > where > > they do mean `\foo\array_key_exists()`, they can write it > > explicitly. > >=20 > > Functions that are *not* on the built-in function list could > > default to > > the local namespace. >=20 > I was actually thinking of doing something like this for function > autoloading, where extensions could register global functions that > bypass the autoloader and go straight to global if it isn't defined > in the local namespace already. I decided not to even bring it up > because it felt controversial (it would effectively be global first, > except for user functions). Though, it might be a nice compromise? >=20 > =E2=80=94 Rob I think we are all trying to achieve the same thing here. There's different ways to go about it, each with pros and cons, but I think we need to think through how all the parts fit together, because I think if we can reach consensus, then several RFCs become compatible with each other. A change to how function namespace lookup works would affect function auto-loading, and it may even make it simpler, depending on the other options that we end up going with.