Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125446 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 059BC1A00BD for <internals@lists.php.net>; Thu, 5 Sep 2024 21:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725572793; bh=3Gv+2KEDTV7MPbXOQezPLHbU3Yg5v95U97Kcixnuv5U=; h=Date:From:To:Subject:In-Reply-To:References:From; b=czI7PE+nydcOXJQgzkYoC4BPd9FPXLUgE4qjz3uLcoII6zAVWZumeUbcDtEShBqb6 KdyrR5HCF7EtRlBjKMeSRSE5FFWymIN4brSg/RuU99FYamOr4JqpWbxphZJIxfItzm QAx01fSrbRwNEpLTmQ2p8zpR26jkaQ6AoPJ6QWlSz6bkN2fh1v+Ces0xbJ3KAf1ydw jv3QGL3U/84JOBfS5zIUME+/zZy48HUcfuHlBCWU7s2FF0Ren8zV7LmTviJ5qz5DPQ SLqsocbc1C6T1nohdL3vehvd3b67Wa74bFTSeHlyd2RYH1UhDkCUXfKweTEpH6g20d kwbzCoIoPLwFg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 73F75180032 for <internals@lists.php.net>; Thu, 5 Sep 2024 21:46: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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <imsop.php@rwec.co.uk> Received: from fout8-smtp.messagingengine.com (fout8-smtp.messagingengine.com [103.168.172.151]) (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>; Thu, 5 Sep 2024 21:46:31 +0000 (UTC) Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 2DD1C13802A8 for <internals@lists.php.net>; Thu, 5 Sep 2024 17:44:33 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Thu, 05 Sep 2024 17:44:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1725572673; x=1725659073; bh=yBvKAcePPm2YSDcnVL3M1jn1p2Tr5GGL8CKUrcyNhys=; b= sOGEQR7XqG1zaRzYGOaCzzy91eYqFmeQrPF3isrlI03TSKVRvLAXFIDfuuPzXhAe TwTTHazuCU2AfXRoSZ9tkJ4NxvJF/1vDzqEltC/VvFE7VsbLXMbPuoX72N31QB7y SgFOkTeLk8Pwqhw5i9hBXQJVJTtXHkdFlzry5vbonsuGQflt3zenaxJjcvi+cw+M 1Q6dXJtDEENYK3w/OVylsHLV/C2p94rkmv2IrmH5jzF8Y8eGeN4+clqsxx+WU7Oc hoUiLsCCaLBxSm6R/Gmv+RTZCmpaPK6+YADdTs9y4grF71SFZDw/F4GvsTueKm4H i8TM2aF/jRvn1YYow1bukQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725572673; x= 1725659073; bh=yBvKAcePPm2YSDcnVL3M1jn1p2Tr5GGL8CKUrcyNhys=; b=H J3KdqSfBWaL9vdEbR1VhbgSalN3LR8sLqm2kHtX/mInYg8jej1htLSYzaQ/3u3a0 P0t0ZEO/Ogh/RDrsedBSwpw++3Ab9e9GN/02TnZ2sAJfYaphG4Iu0Hpgqn0zaY9y 2xGwHiRyfC3x3LveZW6nZcR3bKWt9GNYCnTf4vh9oHqrYIhj1otDcgE2cF5U3X/u iMpXZeaIdZ8zwhjFRUiz+Q/rEjrgiKxcM64rgTM/WOklq+pIwGRKEiCCVll8dr6M zWJs3TzN6zlHUMB52P3YgRQEbgcnLA1TOPm4paeB3ZfaKKcp16Wj69Q+F0ss79xm L9uTWro11yffSY/2F/7nA== X-ME-Sender: <xms:QCbaZqcwWcS_pSSTlsl6biThT-5JnMkPnajurCN3PDuvkiJCY8y_jw> <xme:QCbaZkPdma_2v-jWBsMxvCfmbfllUYkqntfVabpQUATq7IbUitq7VbdIzadofSwiQ T5a1kMWBaebobkPzyw> X-ME-Received: <xmr:QCbaZri_cQxQuYRQqAiI4RLe8zF15JczAkavmMI01xs5Xa2FdOCsqJfByzty5zy06fe_BLWrTY56cXcLLVaE7cMoTLFiwP03Z1BNJNPHMMOqaz_a-MYY> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeitddgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf gfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhn shculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenuc ggtffrrghtthgvrhhnpefgheekffevieejgeetleeivedtueelgeetgfffteegledvjeev keeuheehveegudenucffohhmrghinhepghholhgrnhhgsghrihgughgvrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdr phhhphesrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmth hpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: <xmx:QCbaZn9dMRGFsy5b0uNZnzvlSIU7C5SU_4sUPS7qGBjhAo1j6FYRrw> <xmx:QCbaZmutXDu4ILa0W3XYtuVcXqT5Yr-V_n_kDe5mN1IVklqOCqVd1A> <xmx:QCbaZuGUzrNkIPCdFutOVIInefmAkehyMTlCcYAvEHSGnw-hKA7qqg> <xmx:QCbaZlMbwfg60UDRFt3QYWSXxD-TkYmrNCTJgyTga3idpKByBfYSgg> <xmx:QSbaZrX5IGCufBcuGp3Sv-uv1R5V1IMhcvfE4pj769uRbc8LK7_8-kOI> Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for <internals@lists.php.net>; Thu, 5 Sep 2024 17:44:32 -0400 (EDT) Date: Thu, 05 Sep 2024 22:44:30 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Local constants User-Agent: K-9 Mail for Android In-Reply-To: <77C2D2CC-5E1E-40D9-9FB3-A5C4A6311669@newclarity.net> References: <CAPbW5OMLM=0k_WkL1K556O3+cq06X3iQ7OwgPWyjcUzBJ7opRA@mail.gmail.com> <27c3909f-05f4-4256-a447-10e8d8760fff@app.fastmail.com> <F9C739E2-2FA3-4CAF-9A9B-CE343F84B461@zort.net> <420bb5cb-5fca-4f2e-8c68-0ca327cd3392@app.fastmail.com> <7A98532B-7465-4FC5-B7A9-993E7D430EE1@zort.net> <94510a5e-ae23-4118-ac55-2e90c911e7da@app.fastmail.com> <77C2D2CC-5E1E-40D9-9FB3-A5C4A6311669@newclarity.net> Message-ID: <ED7A6AE0-75FF-4765-BF46-F0A3206473D5@rwec.co.uk> 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 5 September 2024 16:53:32 BST, Mike Schinkel <mike@newclarity=2Enet> wr= ote: > >Not convinced? At least one other person has my same view of the dark des= pair of block-scoping: > >https://forum=2Egolangbridge=2Eorg/t/warning-for-accidental-variable-shad= owing-with-block-scope/4715 > >Of all the Go code I have written, I'd say accidental variable shadowing = is in the top-three (3) reasons for bugs in my code, if not the main reason= =2E And if it were not for BC breaks, I would lobby hard for Go to remove i= t=2E I know that some on the Go team lament that they ever included it=2E Block-scoping doesn't have to allow shadowing of names, and it certainly d= oesn't have to be achieved by that incredibly hard to spot syntax=2E In mos= t languages I've seen, it's indicated by either a keyword such as "let", "v= ar", or "my"; or by indicating the type of the variable you're declaring= =2E It's something I'd really like to see in PHP=2E For one thing, it would ma= ke me much more likely to accept the repeated requests for closures which c= apture parent scope by default, because it would give a clear opt-out to re= place the current clear opt-in of the use() clause=2E I've never found myself wishing for local constants, but never really used= a language with them, so maybe I'd find them valuable if they were added= =2E For completeness, I'll mention that *typed* local variables are another re= lated concept, which has also come up in the past=2E The big challenge in all of them is that these are big fundamental languag= e changes, which require an expert knowledge of how the language works unde= r the hood to get much beyond "that would be nice to have"=2E Let's not get= too deep into discussing the colour of the bikeshed before we've worked ou= t if there's space to build one=2E Regards, Rowan Tommins [IMSoP]