Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125107 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 D38ED1A00BD for ; Fri, 23 Aug 2024 07:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724398173; bh=ajezcfa5c2kVMhGGS1zesKYHZnxRQg2u7bHjFBLiRAI=; h=Subject:From:To:Date:In-Reply-To:References:From; b=QHFiulC2R7piQc20C2UGL+zAX49mmTpU4+56JT+2asdOmW/b6m8UKpkvM9rdKJEIQ KxUc5xlQcXsiDSTOIsEWjlIFrPuGe34W7uFhMa9vsM8bLFs2e7MBfwbWoP0MQMR1KH QLBxX0TX5jYLsQGfVoHtOWwi4tYKcXiP/kA7349pnR+BDMucTeS48V8ISrp98bhYWe O3UpRJ1TwJA59T1f1IvLvuapRd/Lm6kWn8DAZdsok5JkLsYgmR2JlRmk9wIfegAv2b j6SKx4Vop4k66O4BhTPnA3pot2HGZKiCUiW+WYW196t6oy7hVLk8ztlNFl/FRJWFX/ +h1mhpkDoW3Yg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E18A118006D for ; Fri, 23 Aug 2024 07:29:32 +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) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Aug 2024 07:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ageofdream.com; s=ageofdream; t=1724398060; bh=ajezcfa5c2kVMhGGS1zesKYHZnxRQg2u7bHjFBLiRAI=; h=Subject:From:To:Date:In-Reply-To:References:From; b=JyGg0fBt7eY24wi/qS2PgKmcqXA6iI6jO4EWkGJ05gPa6px6Igb9kNjho+hDcW9f4 ZQTCN7ko9w4NJ5WxrRmtECCTLLNJNz0KfPBMxip2pEVRojub0fk0WeguPPE5emDFnj fML2SWzI9zhrEh+SKT7H/wz+L/Z6L95k++c3n3HofjpxUhBnH+8BkZZW/2HWgvA21R 3jWsM6BtGmLylSQKbwJ46kzbGlYqlAo09EKu+ULnR3LpmfYCA4ivgG+gwrdxeftwsV P3DJNnbFSVJ+Twq6c/2fQaMK9iRZaFKoMSLUXHIf+seZjd+DRFozZt168Mh5yAwzxV I3izDQ9Mr7DqQ== Received: from [192.168.1.7] (unknown [72.255.193.122]) by ageofdream.com (Postfix) with ESMTPSA id 81B962508B for ; Fri, 23 Aug 2024 03:27:40 -0400 (EDT) Message-ID: <880ffc27dc9b421407a670c75d5f5ba756870396.camel@ageofdream.com> Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: internals@lists.php.net Date: Fri, 23 Aug 2024 03:27:39 -0400 In-Reply-To: <846D7756-712B-4A7C-9FC6-DB9F858836B8@rwec.co.uk> References: <846D7756-712B-4A7C-9FC6-DB9F858836B8@rwec.co.uk> 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) On Fri, 2024-08-23 at 07:39 +0100, Rowan Tommins [IMSoP] wrote: >=20 >=20 > On 23 August 2024 00:15:19 BST, Mike Schinkel > wrote: > > Having to prefix with a name like Foo, e.g. Foo\strlen() is FAR > > PREFERABLE to _\strlen() because at least it provides satiating > > information rather than the empty calories of a cryptic shorthand.=C2= =A0 > > #jmtcw, anyway. >=20 > I knew I'd regret keeping the example short. Realistically, it's not > a substitute for "\Foo\strlen", it's a substitute for > "\AcmeComponents\SplineReticulator\Utilities\Text\strlen". >=20 > Having a syntax for "relative to current" is incredibly common in > other path-like syntaxes. The most common marker is ".", and ".\foo" > is literally how you'd refer to something in the current directory > under DOS/Windows. But unfortunately, we don't have "." available, so > I wondered if "_" would feel similar enough. >=20 > Another option would be to find a shorter keyword than "namespace" to > put it in front. "ns\strlen(...)" is an obvious step from what we > have currently, but it's not very obvious what it means, so maybe > there's a different word we could use. >=20 > Rowan Tommins > [IMSoP] Could be mistaken, but I think the way PHP handles namespaces internally is sort of the same as a long string, rather than as a tree/hierarchy. ie. \AcmeComponents\SplineReticulator\Utilities\Text\strlen is really like: class AcmeComponentsSplineReticulatorUtilitiesTextstrlen { public function __construct(){ } } And the "AcmeComponentsSplineReticulatorUtilitiesText" just kind of gets appended to the front when the class name is registered. I haven't done work on the namespace code, but I recall reading this somewhere recently.