Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109032 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58510 invoked from network); 15 Mar 2020 19:20:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Mar 2020 19:20:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6ACDD1804DF for ; Sun, 15 Mar 2020 10:42:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2027.outbound.protection.outlook.com [40.92.19.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 15 Mar 2020 10:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h8jDGc91IYnWXScKy9B8ZfvG7WqAqvAVN2m4A6eIeNMq5JMFEiRF4DkAQdV8e07VCkJwrrEqvVXRhZ4pqoe8NfVO9/c+ffh1urOEv+HuQuRUto7rlq9sHjGZ3nmO1WTiauRvscYu4MkM90xN3AWjbtH1BV50gfi1cK33yCW+clVoAUfljiYqkF0vP13Apb6JpyLfcNusLcwyP+Mwpv0be0Av8ewOADQ1NRwyit+OIJucpFxLw3NvT31UQlHbys41Tp+Cl6rIjce+3BMI8+UrwSoNmZwc7pdyhOYrSvvxCwp+8MEqZxQuIKmyx/JhQ+W8S35b+1AJh98qPhTI5lfJtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q6cIOFlxt3QXsSj7e9oWm9SasTN5snDYfJnm61R/3D8=; b=H6LLKvwKSg8WT9YBa7LAX6h13y2iwPVpZPk8dUUQctrCpor3LcwOYgx12CUioii8wzTPA5j9IYcv6Oj4nzurYWG+fOvcSyiUe5c02U7Ga2phnA3pgGbmvpC1PrfvrgouQPnZtKk286NtEXnUrd718RW3i3Gv/xFrh/T/Z54UzY6QgjXWBP34uU014mxyxGnPbjtQf6OxlLP7gHLeOgrZFpFmC48j6NdkZBcBw8r3NseQBLilx88+YvUy508iEpSYk4PCOLaJ/1hDCFCrI+D9c6LOOlNqHa+j+LSPqXSBhOvzoNfZx/yBlP/jbIi8r4OEruTi4ynMGetSGJe7dmCY3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q6cIOFlxt3QXsSj7e9oWm9SasTN5snDYfJnm61R/3D8=; b=apl7+WkfDJJqc9tYajowwMCqeLw3tfqPlyfyCYT6gFMRvSILcQ3sgVxjx+gPs7t5Q07CO5aqhCAVVVoIArS3P2JPGKKm7g3RjRF1JM8oOPfWdREk/uoUviHcMaMXqq/fxEucQwA31LMxvSnx+PjIQcQIKlvQK3a2zOcvn/UMz8izane3hx1jORzyPVhB3A5v1mx+if9hPnEiFJ1BglGZMaLEndhw+KV0I/BmAk5ybcfRSLmyoJr3/vjRIRS55Ut4/insIZJalzhu2+fgtqMutUNx/DnYOilIcBZNj0iprPqy7os8pAApn7CrNdVpUSbiGb/OSlGkT9ZVNrcyFiHtRg== Received: from BN8NAM11FT047.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::3c) by BN8NAM11HT230.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::452) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13; Sun, 15 Mar 2020 17:42:40 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.176.57) by BN8NAM11FT047.mail.protection.outlook.com (10.13.177.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13 via Frontend Transport; Sun, 15 Mar 2020 17:42:40 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::1133:bcac:caf1:d588]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::1133:bcac:caf1:d588%3]) with mapi id 15.20.2814.021; Sun, 15 Mar 2020 17:42:40 +0000 To: Christian Schneider CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] RFC idea: Block scoped variables with "let $x = expr" Thread-Index: AQHV+ug0CGaQ9aFqj0aNq48f2k+kqahJ5iaAgAADyzE= Date: Sun, 15 Mar 2020 17:42:40 +0000 Message-ID: References: ,<38BEBA80-AB6E-484C-A0C4-EF440C27DBD9@cschneid.com> In-Reply-To: <38BEBA80-AB6E-484C-A0C4-EF440C27DBD9@cschneid.com> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:6FD02B8F761592D794980C394BDF445CF1841630284B963980F9A5FC9EB2A01B;UpperCasedChecksum:347B20776FD112EB89F40AF0E8E3490966E867D3603A5017079D5A9FFF0BC3B6;SizeAsReceived:7231;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [HmwtxXJtnuRRHJSOSZ/5h9B/TfpLB968PFPRQR2ZkxuvW20YU0DxmHQMphSjbO+S] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 4aafef38-0264-41a9-ba92-08d7c9084247 x-ms-traffictypediagnostic: BN8NAM11HT230: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6HcSGxXhtGCFp6H3nDoC8sHxOFvDRPJFXxA9LfcVhUansMlUds3wk/eBsw0KV1LiIw4GSSL15gA9jUUGz4bz90ojYPL+s/xB14RXu5nUsGBIFXo6BDtbBE+JNi4FY+f7xOGuoeJcaRNEU4SngJFPwR046J3/MqBME6YikVHBVRD8WC7tgnqVviAlRXrKJfFf x-ms-exchange-antispam-messagedata: MYnyXHK0M9Tqw8nyg9yfcvTEdMxMD0OzX/U3GZctWjcV8/uFuufIreaqns8wrrQiVdH3eHrLYyHti5GHa/LJsHUAjvPoUHUOQf/qdvuAZTai0uJaSWU//qPEdyR6UNRJ247tLemyWI9rvR3dVvLNTSfDM09lO+PHPao0VGckNfD77NY2gOOGtUbvs3SwMR9/gS09GpeY8Az0J31RrYfxJA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 4aafef38-0264-41a9-ba92-08d7c9084247 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2020 17:42:40.4373 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT230 Subject: Re: [PHP-DEV] RFC idea: Block scoped variables with "let $x = expr" From: tysonandre775@hotmail.com (tyson andre) >=A0What you are suggesting is that a let statement would switch PHP to an = altogether different mode where function-scoped and explicit global variabl= es were suddenly disallowed and an error within that function (or only afte= r the let?).=A0=0A= =0A= No, the variables with the *same name* as the variables in any "let" in tha= t function body would be disallowed. In this proposal, variables, parameter= s, and closure uses with different names can be declared and used normally.= =0A= =0A= I mentioned $GLOBALS as one of the ways in which this proposal is a best-ef= fort. However, I'm not proposing to ban $GLOBALS (but to ban $$var).=0A= =0A= - The top-level statements of the file can either be the global variables o= r the variables in the function which required the file. It's not known whi= ch at compile time, so I don't plan to ban $GLOBALS.=0A= =0A= > That sounds like a bad idea to me as I'd have to look at the whole functi= on to see if there is a let somewhere to determine the function's/variable'= s mode.=0A= =0A= A developer would run `php --syntax-check` to know if the variable is being= accessed incorrectly in a file.=0A= Various tools or scripts exist to do that, in Continuous Integration or in = editors/IDEs.=0A= =0A= If you meant something else, could you give a code example?=0A= =0A= - Tyson=