Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124663 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 E429D1A00B7 for <internals@lists.php.net>; Sun, 28 Jul 2024 08:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722156583; bh=awxqxM86mDVVrZmyR+zfevEUpZJwjZ1D6RRX/2xYfEU=; h=Subject:From:To:Date:In-Reply-To:References:From; b=d+olJVkR1cJ2e9Z/K+qVpn0IqL72srtXdn0cCyP7rJ0/5Gtx4pb4QU8ZinxiHbo0K gJqpC46znJs5J0nfs5GrjNkjm1QxyxGE+BGeVC5vm12AJipabGXc4RRyniO7zJDdm2 qNUVxcqnQQ3YD8QqjeGCiXn/xhUhf6Y6Ug7la3NmcEGxRZx+3+YsyxSfTpa7TNxUeV BdZoDh6Jr4n9qtqG3q7SRDGoAeKb+fliS0Z7Rw/Q1iimVm2jFJaCDN/dFVwLqIUpqu a/A+RDSJjoOXyyiuksxUREm7iFEV4C6MypidGB28Hz9rkfd+tiQXTjeNp8Ybgrkkhs zlahZEpPjJRZQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 85990180082 for <internals@lists.php.net>; Sun, 28 Jul 2024 08:49:41 +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.2 required=5.0 tests=BAYES_40,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: <lists@ageofdream.com> 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) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Sun, 28 Jul 2024 08:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ageofdream.com; s=ageofdream; t=1722156483; bh=awxqxM86mDVVrZmyR+zfevEUpZJwjZ1D6RRX/2xYfEU=; h=Subject:From:To:Date:In-Reply-To:References:From; b=EbfAdpkC3uif7uTYAcML3n0SUzG6awMnL3wDk8G1BVQWjE/xKSKpdTFnln3hPMaE/ LDAEbharxSvIsvr5HTxJXWB4BtvIHKSmhuuJoFJ2RmKDy9OjUhtsd/8RUhgzZaPb2N tbX+zqN8gsMwY31/Z9ZhCaWGJ4Xv67t2m0mAD3BUrGP9ne6Bx11AfTP0tZd2Ho1J26 5uifXtXHPvR/RPMkV6A8rdK9M0XJ9dfvwTjSXgWucHJeW6C47UT9eCohelEtMkBKYx i7LnCKuvu+6rC0glvpvIq9RhC0LJDqsFvUUQaPrJRAg6XowZMjwU7g3hV4AOy8yfmm 2LJHDokah8c5Q== Received: from [192.168.1.7] (231.subnet-69-85-112.ellijay.com [69.85.112.231]) by ageofdream.com (Postfix) with ESMTPSA id BA8642798E for <internals@lists.php.net>; Sun, 28 Jul 2024 04:48:03 -0400 (EDT) Message-ID: <bc527ccb1da43dfe8e7ed2d59bef6c5a979a9670.camel@ageofdream.com> Subject: Re: [PHP-DEV] Should PHP reserve a namespace for built-in classes? To: internals@lists.php.net Date: Sun, 28 Jul 2024 04:48:03 -0400 In-Reply-To: <630b4e1e452d40e5f807d155cf97a10550ee4dd5.camel@ageofdream.com> References: <76559a9cd5eca4bc6799ed9612ce15c28cd7cb0a.camel@ageofdream.com> <95f6046a-4acf-4f8a-a850-a23650c0c6b3@bastelstu.be> <927705b0404e70b0f0ade4a3354b2598d7c112f9.camel@ageofdream.com> <86b7e340-6ca9-4b3c-af0a-a5c2d1ee68c3@bastelstu.be> <ab4c1bbc8b316d81cfcf22e416f38e408745f89e.camel@ageofdream.com> <098864EF-9D75-417A-82DC-105082DA3A23@gmail.com> <630b4e1e452d40e5f807d155cf97a10550ee4dd5.camel@ageofdream.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk list-help: <mailto:internals+help@lists.php.net list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net> list-post: <mailto:internals@lists.php.net> List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 From: lists@ageofdream.com (Nick Lockheart) > On Sun, 2024-07-28 at 00:48 +0200, Claude Pache wrote: > >=20 > > For the case of functions (and constants) in the global namespace, > > there was an RFC on the subject about 4 years ago, which has been > > declined; see:=C2=A0https://wiki.php.net/rfc/use_global_elements=C2=A0a= nd the > > discussion threads referenced at the bottom of that page. >=20 What about: namespace foo; use global functions; =20 class MyClass{ // do stuff } =20 The `use global functions` directive goes after the namespace declaration, but before any other code. It applies to the entire file, but only to the current file. It tells the parser that, if a function call is found in the file, use the global function. Do not make an NS lookup op code, and if the function is a recognized built-in with a dedicated op code, use the dedicated op code. Methods and classes are unaffected.