Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125127 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 8DA201A00BD for ; Fri, 23 Aug 2024 12:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724414776; bh=vC+oW0VHxSpr6CevE9hNus5jENXSB1lZYTzkc0i3MBo=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=NquqgSRE82xwqAPcJ39I9AAUpvAraSmfdnbNKA4hA910Ixzaomfxt2vdW4rkA0G71 i8Nk5tQCAHMi3vClWsHhI/NhTyvhrDYgKH6wE3SLMBuSrmz96KfyFU0rX0c7AVzGBe hfK8CEsiKhU/CHpMSWLEdZ2zo2/aCXeq25j5YvY7a++VARxQGLk6PEfNVnGgY039jR JAyTIijuENcRubxxxx+4xovXFbRoiCK0oX0EzVWmTimoGFQP6spwvsZC/m8H8ojUtx Q+aF1z5egWYVlleppDUi/MvDaW9AjKXAMCb9n4EMUO0/1ta7jorrP+KebJ0TBwVPoh K/xyg+eTF7lnw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BBDEE18003E for ; Fri, 23 Aug 2024 12:06:15 +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,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 12:06:15 +0000 (UTC) Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e116a5c3922so1844028276.1 for ; Fri, 23 Aug 2024 05:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20230601.gappssmtp.com; s=20230601; t=1724414663; x=1725019463; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=horz5Px5mF6CgSZ4ANmflqZu1BT/Y9j1FIzy+md2CHI=; b=0K7DVX+3lKpDY/c9nC1fowGGUwzp1lDQIei/dmB36rUaU9IGa/K8e9WwtgUpuiZdbc iRm5tcfu4inznvoeS10DHgqePp7xRHJbMiUHxhKgjhVi7WvSsJu22WW2X0ackiBknmup EwO9byI+obY3O18W60SmJaClV3YFOhlADROQUot9mg1GcNrbC4sHLXRzPLTkJ9WJJxvW HJVPBN8c3W5gFrB0kpW3BmvvBU2rcTxzFg2Ef/72WG2+uUWNO8dJl5f2wR1LyGKPr0XK PU9dPMkqYX6GF6ArzKtRIY7Mw/AFgb+aFzyxpCLRDSyElNlYngip9kqoWmWd6ZUndK3U j2Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724414663; x=1725019463; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=horz5Px5mF6CgSZ4ANmflqZu1BT/Y9j1FIzy+md2CHI=; b=bby2+nOLFYIilzhGx8s086rPlpn+0PaUdH9vIx3UVy4RqscxM7mMTS8wzONxMkgr+f h6K1T+RnQ5UpaOtOMXgySDAxhL4K66UY8pJzBKIiG/Za8JnniER0fp98obAKtwH+2w+U DFa9nbyFOkEBQE6mFvatsmtfzZplwMPuNPWj7jl9VuCUgL9LVXgvzOOvA/K8bCXtY/9n vznT/E9sQpDaEeWevbzflUs3ploa2KaJTNxWOP8n3xZ/w/bCxnKye/dPCdkVpVI8hsOz 6CrAbP/ltRlKfbm1CMMnH+XTGnDEIfAn/Oj08Szys/Welz9R8qoJ+NuA0F/da6eBHyFW vGug== X-Gm-Message-State: AOJu0Yy3xg41w5nvInyIjbwTqT+K8i7xgtabRR/X2JxNcZwg5lUcNIv6 C3aqphjOaNNoPdZBdk4+LR2GAuhyOteJbD06o5Qdj+dwmlVK21++PMvRCwFbo/o= X-Google-Smtp-Source: AGHT+IGYhDBQKnb0FFzmeZVLzlLkAE4O7mmux2MoUJ66sOjYbWz+/rszQFIYWHoyLp6cYrrM0m12zg== X-Received: by 2002:a05:6902:2588:b0:e0e:8adf:2e80 with SMTP id 3f1490d57ef6-e17a868690cmr2181345276.44.1724414663437; Fri, 23 Aug 2024 05:04:23 -0700 (PDT) Received: from smtpclient.apple (c-98-252-216-111.hsd1.ga.comcast.net. [98.252.216.111]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e178e4b71b0sm652246276.36.2024.08.23.05.04.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2024 05:04:22 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) In-Reply-To: <838adce3-12da-49f3-88f2-883d63e93e89@app.fastmail.com> Date: Fri, 23 Aug 2024 08:04:22 -0400 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <86C995C8-AFF0-4E4B-8385-69BC701B887E@newclarity.net> References: <846D7756-712B-4A7C-9FC6-DB9F858836B8@rwec.co.uk> <838adce3-12da-49f3-88f2-883d63e93e89@app.fastmail.com> To: "Rowan Tommins [IMSoP]" X-Mailer: Apple Mail (2.3696.120.41.1.8) From: mike@newclarity.net (Mike Schinkel) > On Aug 23, 2024, at 7:50 AM, Rowan Tommins [IMSoP] = wrote: >=20 > On Fri, 23 Aug 2024, at 12:29, Mike Schinkel wrote: >> namespace \AcmeComponents\SplineReticulator\Utilities\Text >>=20 >> function Foo():int { >> return Text\strlen("Hello World"); >> } >>=20 >> The above of course could result in BC breaks IF there happened to be=20= >> existing code that referenced Text\strlen() where Text was a = top-level=20 >> namespace >=20 > It wouldn't be a top-level namespace that would cause a conflict, but = a nested one: currently the above code resolves the function name as = "AcmeComponents\SplineReticulator\Utilities\Text\Text\strlen" (note the = "...\Text\Text\..."). How often does that really occur in the wild? =20 And how can it occur without an explicit `use = AcmeComponents\SplineReticulator\Utilities\Text\Text` statement, which I = proposed would override the automatic `use`, anyway? > It's an interesting suggestion, but I'm not totally sold on "use the = end of the current namespace" being easier to remember than "use this = symbol or keyword". >=20 > return namespace\strlen("Hello World"); # current syntax, rather long = and unclear > return _\strlen("Hello World"); # short, but maybe a bit cryptic > return Text\strlen("Hello World"); # variable length, relies on = current context > return NS\strlen("Hello World"); # shortening of current keyword > return self\strlen("Hello World"); # maybe confusing to reuse a = keyword? > return current\strlen("Hello World"); # clear, but a bit long The only one of those that has a strong analog to existing PHP code is = to "use the end of the current namespace" as people frequently do with = explicit `use` statements. Yes, `self` has a weak analog to `self::`, but none of the others even = come close, IMO. And adding `self\` may have unintended to the language, = some slight BC concerns, and/or downstream consequences for other = projects vs. a simple automatic `use`. Lastly, no comment on `\\`? -Mike=