Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108254 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65955 invoked from network); 26 Jan 2020 23:27:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Jan 2020 23:27:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0991E1804D1 for ; Sun, 26 Jan 2020 13:37:29 -0800 (PST) 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 NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2032.outbound.protection.outlook.com [40.92.21.32]) (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, 26 Jan 2020 13:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ot8J3YnHlZR3NWpFczUesVXQzyglSCkDgqkMl9g93mZ6Vhz3PlY53dG8CqnjjQZ4AEIXDVQCvam1oDYmj7jvbBn+CTLfDvX+XcOeitnFl/3+6kmmuY6efq7PhdsKllG0DQGWT9v0j2pT8W/ga1VL6OYImzZvz8CR/XbCL59yGBQwuL/2Z4CQrhOv8CwEQIdxTZnGWVCIJS1fP7cDKV81KseZKAKXVH19yzvyark+Jm8qmpYoUTJMzqJLhnp8ksrE4WXwTyANE5rrEd4Ujxpv/A1S6Rxm688JD4LidJNV9FIfkgjeVuUAupVBcGj1q4j5iujQwthasm+U4J8Hyc9dtg== 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=6pijaidCjnE9upGeDvNTY1RbdOjDmVFhOn+VWRY7GTM=; b=BlgYHLv9gWxpnEJe+ddp5y1DKmUhbE3uZ8IIt90ytFF8sq78001MNME38Q+LJNk7/JtL2OjCjPDu7lIgFObwmVEYsUM1OyPuKVIWE1rp1dZEXleZUR6K6+PxSsr6NpJDp7jl3F4Us6g8NAXR1F9bObBJzttdXcokZJ4Kqrn1luoZP1F9XI15n0tFLfcpeA6yJ++LE7Hhcv1z5LIDrO+nGtu8ozyIf5YAQz9rTFJbyWq64M28zFBJRqz6vSIdElz/BaqQuuAITnIO+zxKdeSYSFnS8bBWbY6ODpcYsle/JpAqbfZxYRnpzP30dXWso+eQ2xLs/pgs/4CO15az4weuUQ== 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=6pijaidCjnE9upGeDvNTY1RbdOjDmVFhOn+VWRY7GTM=; b=nRN9RM5QcMrWO8NLrlvowXXiCx9jcGF5da7QVaYyVlRDYgw7tIcVamovhoxiSxncDT52XkyV/PBct0zjJyB7s4A8feHOBmazhOLuPdQEW8mpraVogB23OgDtoVKeiG9pypRHwpyxStmYsceNRxrU3E4UoZuCZDkQL51W4Dd/s/4mgEmAqjaubr0apL31I6DAbu11rgBwgTMR8vKja3YcXSEL2X9VCQSPHNib/UVGvYhD31UxTqFq+ujXC3d8AmuWcJwmCsju2AUz7GDbwPB0Oe39keuz48nV1yZrQguB8Hb/UUPoPaN5K2dykXOpm9/sB60D9nM8OFUq8bTIa2XPNA== Received: from MW2NAM12FT027.eop-nam12.prod.protection.outlook.com (10.13.180.58) by MW2NAM12HT230.eop-nam12.prod.protection.outlook.com (10.13.181.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.12; Sun, 26 Jan 2020 21:37:27 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.180.60) by MW2NAM12FT027.mail.protection.outlook.com (10.13.180.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.12 via Frontend Transport; Sun, 26 Jan 2020 21:37:27 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb%3]) with mapi id 15.20.2665.017; Sun, 26 Jan 2020 21:37:26 +0000 To: Claude Pache CC: Nikita Popov , Nicolas Grekas , Mark Randall , "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] "use global functions/consts" statement Thread-Index: AQHV1IfBuqjWnIu9lEWrxlRKvYFij6f9dXec Date: Sun, 26 Jan 2020 21:37:26 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:B4A7A0AC36B444BC88FFC35ACD605BA4691F861C85A96B47B2FF0D2A12A28306;UpperCasedChecksum:58D3627F1E06AD6D08D9F1C64D29DD7F39B6D52772EE55A3D7A9D651789C9364;SizeAsReceived:8038;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [EPHj1zC1rVodRlLcVXt0I0nu/KBOfG6c] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 7ed1bdb3-d348-4beb-3531-08d7a2a7f007 x-ms-traffictypediagnostic: MW2NAM12HT230: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hJpIQ5ezYE9xUSOYDn04sG6wM8TnAv2O8kwbJKp/2Ag8H0z2Qv+2DUXZc3AXZvW81qULn8LZiarTlRbQu42sQZUYBx13Hg0QjX4T4UGkIUHPWwQ29WL8fhLfu1W5a2PBgt6AC4Yy0gSZgGnGglj6GXKox/mHk6LXAvZ4PqQ3z02p9jxyLgz7Hf8qtTWwzz+4 x-ms-exchange-antispam-messagedata: FF03+IJDcVhyNgK2+5KeRDO0G3kl9OUv7RjW7Yoz46QTSucbFXymnAv8MsZvjY70rrHk/JsabBU1/uzvyHgpBphKpaU7Z3Es/Eqw/gaoUtNGZLbrOm86pfXz35OXeOOJWFOkwUo+8+Xiz5xOt4SX/A== 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: 7ed1bdb3-d348-4beb-3531-08d7a2a7f007 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2020 21:37:26.5227 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM12HT230 Subject: Re: [PHP-DEV] [RFC] "use global functions/consts" statement From: tysonandre775@hotmail.com (tyson andre) > and that you have to explicitly say that you use the current namespace fo= r that name:=0A= > =0A= > declare(function_and_const_lookup=3D'global');=0A= > namespace MyNS;=0A= > use function MyNS\foo;=0A= > // or, equivalently: use function namespace\foo:=0A= >=0A= > function foo() { }=0A= >=0A= > foo(); // <-- this is the function defined just above=0A= =0A= That's a good solution to the ambiguity that I hadn't considered. Functions= and constants should be relatively uncommon for most projects, although I = can see it getting repetitive for a file with dozens of constants.=0A= (e.g. with namespace-scoped declares)=0A= define() or declare(function_and_const_lookup=3D'global') should be adequat= e workarounds.=0A= - A subsequent RFC could reduce the restriction and make "const X =3D ..." = always act as though it was immediately preceded by "use const X"=0A= This works better for constants than functions because constants can't be= declared anywhere but the top level.=0A= =0A= `use function namespace\foo;` is a syntax error, though. It can only be use= d as `namespace\foo();`. It may be useful to add if projects adopt function= _and_const_lookup, or other changes to namespace resolution get made.=0A= =0A= - Tyson=