Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108230 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 33206 invoked from network); 24 Jan 2020 19:49:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jan 2020 19:49:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 48D3518062E for ; Fri, 24 Jan 2020 09:58:52 -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 NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2086.outbound.protection.outlook.com [40.92.18.86]) (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 ; Fri, 24 Jan 2020 09:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBkKjgavAaDFCKwWPuD9mOI0WW27/ZMaM0I+h6D2P47Kv/goO8hvJJhBzlwSuniBC30g/AGGQX32hvEUV6IfBv9HPtmMehIvVSJIL4aTJW9Bhw7T0AhQotfF7bipny4Hzo0CWdrm8TguC59u/B9D9H/pKhYku5k4+W7h9NRLlrDZhpaXZg4XKV5L0P3wmlOjRJWyQX7D0uOvrm69kbx7RvvaFzGc8/fzvite+9wkv7cCmAkCkB4qMdIP4PG9Nej/fsfs6ncGIvpHkqiKxhdd20bEIblEnC9CKsMPrrwpRNurElcSNvbnzyvpLo6p1iY1pfiM2+8pfiFk480k83teew== 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=85BUdXEhq7m0XYbpBDuAqeEiIJK+Zq7UOLHBbFN/H6k=; b=ZMWGw7gYfCcuqh7DA8HmpGeEUEukNPwwccXWjwZK1wydARlisI7OW/Gv39BHCFR1OIFJrUjnUpAYPqcMKtBGPk0TdXkjXbVtPn1jMQD7w98+5szkzIp8eTW8HVPeqdp0t/nveLbSLJ/nxmNhMU0j3HRMI2c6hQtIcVgomnPw6NCR9cpbdu5tg6aF1xFU5ykaOW51LMwv11sw5uCQs04n7fJYRi8HD/OHMmYPxdt+VydbU+ojY8qq4pIt5e9m0cD2YIxdgNWjHEPBQ/tGTBOubslxo6xPT22+EkhBZujeRH/AgEoMMzQ1jNkv5a4IOHdTrrpGTGOVVo4z+Qc84TKTTA== 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=85BUdXEhq7m0XYbpBDuAqeEiIJK+Zq7UOLHBbFN/H6k=; b=GFNfdGXFHvnXE+VuXxE6M6tEMiQsg6uYh5ah78E8/8MnmZNcamm+SKRn5a7R1cHX2jBGhps6wWlS+5Tn3scDNj9lUMPHqdXCqfGlOAdP82pKyR2kyb5mSZFJch4C+NaOurIsigzyE1zQ7luCLNdbkxOzjj9W1aGFUHeMEiby0mKW5OZlFdh5WPsIR/c5XGLd5t7j0p3IpBfvZvnTTLnjDYzgxA15ERQQk5KXBUlmCkQ5V6K8287JXjbOghEV3CH3p9QA0lg70g3RGSrdykcoHOjow5dHxrySS9mBDJ8FqCY4mUAJalkXMrSU0QP/o5wzC8NSbvPSp2OlAJ5JcyLqhg== Received: from CO1NAM11FT014.eop-nam11.prod.protection.outlook.com (10.13.174.59) by CO1NAM11HT090.eop-nam11.prod.protection.outlook.com (10.13.174.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Fri, 24 Jan 2020 17:58:50 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.174.51) by CO1NAM11FT014.mail.protection.outlook.com (10.13.175.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18 via Frontend Transport; Fri, 24 Jan 2020 17:58:50 +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.2644.028; Fri, 24 Jan 2020 17:58:50 +0000 To: Nicolas Grekas , Nikita Popov CC: Mark Randall , "internals@lists.php.net" Thread-Topic: [PHP-DEV] Re: [RFC] "use global functions/consts" statement Thread-Index: AQHVwNgGtev425C1jEaW2/fYCDQJoKfqjUCogAA6vwCAABZSCIAF7qHQgAA+1YCAABKbIoAI/p4AgAAC2gCAABgFtQ== Date: Fri, 24 Jan 2020 17:58:50 +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:3DF1F29C236ABDBA4DA3946BE32B98147E7CC71BC35275BDCF35B6A673C6C248;UpperCasedChecksum:36CBD76C81F7E2F26D6C8B1AC79AA20A1050A83FA5D2708DC41D619200F42A43;SizeAsReceived:7791;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [AWcfyrkZlXxJWaZ7E37I08EL7vPHQ1CR] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: e7a32a12-736a-4d68-c4b7-08d7a0f71139 x-ms-traffictypediagnostic: CO1NAM11HT090: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9+JXML1hv9Dx0FSsfH5UTPH2oN3Fpyjsk3ZRUJg8I2ogy8dc5PHEwWjx6bx72UDWbFZ4ARqW1cR/HDgC5ORQcIqxCZmZkdkRmHMEd5MXde8DZjZf7soh092ZSTdc/2sohyh8UVqdUtMH3rmzoL1rRzMOTFwJZ2orDT3JM7PFSDi0U2ZJf1hRh0IV90EFEd87xJk9vBrOTHbUHIuOuKFTQvlydh33KW9MP7tiAsb0CM4= 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: e7a32a12-736a-4d68-c4b7-08d7a0f71139 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2020 17:58:50.1979 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT090 Subject: Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement From: tysonandre775@hotmail.com (tyson andre) > > One option that I haven't seem much discussion on is the opposite: Alwa= ys=0A= > only look in the global namespace. Any unimported unqualified usages will= =0A= > > be treated as fully qualified names. This would match the proposed=0A= > > semantics for functions/consts and change the resolution rules for clas= ses.=0A= > > =0A= > > I think this would have relatively little impact on how code is written= , as=0A= > > classes already tend to make extensive use of cross-namespace reference= s=0A= > > and the import is usually IDE managed.=0A= > =0A= > Quick reaction: that'd make sense to me!=0A= > =0A= > Adding a "use CurrentNamespace\Foo" or using "namespace\Foo" looks easy e= nough to adopt.=0A= > Does this mean you're suggesting to use =0A= > declare(symbol_lookup=3D'global')? Or shorter: declare(lookup=3D'global')= , or=0A= > maybe even declare(global_lookup=3D1) as I'm not sure we need 3 options h= ere?=0A= =0A= The RFC has been updated after feedback, but I forgot to update the wiki an= d PR title.=0A= =0A= I sent out an email last week mentioning that https://wiki.php.net/rfc/use_= global_elements=0A= is now a single `declare()` setting `declare(function_and_const_lookup=3Dgl= obal)`=0A= =0A= > Always only look in the global namespace.=0A= =0A= Other RFCs have proposed that approach.=0A= I mentioned the objections others had to that RFC in=0A= https://wiki.php.net/rfc/use_global_elements#deprecate_the_fallback_to_the_= root_namespace_instead=0A= =0A= "Deprecating the behavior of existing code would break (possibly unmaintain= ed) third-party libraries=0A= and require a lot of code changes, discouraging updates to the latest versi= on of PHP."=0A= =0A= > I like the idea of using a meaningful value here, but think that this=0A= > should be using a string, i.e. declare(function_and_const_lookup=3D'globa= l')=0A= > rather than declare(function_and_const_lookup=3Dglobal). Currently declar= e()=0A= > syntax uses a normal constant expression on the right hand side of the = =3D,=0A= > and I don't see a strong reason why we should deviate from that for this= =0A= > feature. An existing declare using a string is declare(encoding=3D'UTF-8'= ).=0A= =0A= Whether it's quoted is a low priority to me - I went with the unquoted impl= ementation=0A= because it might be something repeated in every file of a project,=0A= and it'd be slightly more convenient to avoid quotes and use keywords if th= ere were=0A= many more settings with different values (=3Don, =3Doff, =3Dwarning, etc) i= n the future.=0A= A difference is that it makes sense to quote encodings such as UTF-8 becaus= e of the '-',=0A= but not as much to quote keywords without special characters.=0A= =0A= > It looks like the implementation has been updated to the style proposed= =0A= > here, while the RFC still uses disable_ambiguous_element_lookup.=0A= =0A= Fixed, forgot to update the wiki after updating the implementation=