Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108291 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 793 invoked from network); 28 Jan 2020 17:32:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jan 2020 17:32:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4D0DA1804F4 for ; Tue, 28 Jan 2020 07:42:39 -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-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2069.outbound.protection.outlook.com [40.92.19.69]) (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 ; Tue, 28 Jan 2020 07:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KShOshHZ5pPz7z1Tkz0oB5MUmlD/5kJL9VTutfEw/Rynp0eD9U9FN5IQfqt/9sGeYTrfw5DAgzgs77bmRH/h3r+d4SgDG/sY+TfAxpWZqJQDPC/v4+doPYjgEy1osqsTbPxg9Y4qRZHf+IKyEIED9bhki9O0zjDFVc4AN8RirQOrhwsJ7GZyaSM2N6TlLuVTlrx1SKGF9vzKLunu80SfYNfoSnI1sI+KWYvoLAVd1UzTD4G42pc7BlomVqA3xbJ5BNF8Mq4SGMhdt+7ZiLcWLKAGn/H6f+Npyt2Q6i0ZaDWepiemZXijGEUI/6u73emSr+tdhg18cjxY7bM6LS2evg== 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=895g/JGzt2q2b5Vj9bVtJuZmYJgmErEGcYQMQtOP1M4=; b=af2DXPzVoGJjOq3xby70lUe7dIDxE1S/3KPOVdBlU+bU9hZ5lfys2vN8vQ6RVxBT3oQur7fdFc09OOZ0pSf4stxubUUQ8b2lS/FGNU/SEQEhwkfxySXEqJka6ns9FEX7oW97OFFWxIuBYBa7J/QgRySv4mQ8bmeb1Ff1qnVhSGzfm3FkR8oDQIFnjUp7JF75wnzPVCI/RBo/5DBuNSu5aPcXbo+zXxuDbSzP0Vid/Cuctuv3YI5gLapVaKDqoUzYqcmBctP4f4RBXfQHx905I1G6a9euj5wpbLUsCgkRRQrP2jutRabAJNjVDHracstR/tWm9liFqudF8GjETgx9ag== 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=895g/JGzt2q2b5Vj9bVtJuZmYJgmErEGcYQMQtOP1M4=; b=XtKufcG7MhZJ7uuZ8iOjJobzh6kAiIqeBJbfEUZ13PKMaV9KKk/lZQTyufj3w51nVUg8+/y9rdLO/VGSNTsLRE1SVdJRmo2EVyEXC/WA4qVuvTKf1TErOOW7192uOvVm7Qro23E/HFDnmhFqwsUi9nTYtVjTyvA0tmLX/xJe0tq5DuJqMTjLvC51BDt5dYFpO5sSkDaSknmwJqcp5DR2tu0Yi0C9I23+qp56udy9HgbnXdQzFrOmddvcOzPrIqvvMbPDtbjGw6ai+ImyXNakyH0agpdruByW2fZgPSf3zQ6UpDro8pbMXkdnusdSr7bEPt7is67QzH36keCTL7EFug== Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (10.13.172.52) by DM6NAM11HT232.eop-nam11.prod.protection.outlook.com (10.13.172.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18; Tue, 28 Jan 2020 15:42:37 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.172.57) by DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18 via Frontend Transport; Tue, 28 Jan 2020 15:42:37 +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.026; Tue, 28 Jan 2020 15:42:37 +0000 To: Rowan Tommins , "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] "use global functions/consts" statement Thread-Index: AQHV1IfBuqjWnIu9lEWrxlRKvYFij6f9dXecgADKhQCAAFMdqIAAWbgAgABUv12AAInJAIAAbhnX Date: Tue, 28 Jan 2020 15:42:37 +0000 Message-ID: References: ,<2d50c8c0-cbd1-0a0e-4098-eb00facf86db@gmail.com> In-Reply-To: <2d50c8c0-cbd1-0a0e-4098-eb00facf86db@gmail.com> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:6D2901BA2C926D436E7F6F1AD5538148D5056983994D003DBF6EC72BF8A94CAA;UpperCasedChecksum:087A67CBFE386533D08327DFBFA858C7A8D40A0C4003EE71E54286AD0DB1B228;SizeAsReceived:7968;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [lEO46QqutRCRr+V49V+Zb+KCGnUbZ/h6] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 9cd0b327-c2f6-4bfc-0531-08d7a408b38f x-ms-traffictypediagnostic: DM6NAM11HT232: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: glFLU8puZJOb9QzhOtliLpY7rbLwbbLROO3qLy6oO/HDZlSexL8QJCfiyzN/VJBhwbKdJIL73cKW87BvK7pbeVPI7NqnM9xW/ZTCU8DnGU2DHi1SVEzv+8NWWBjAW2UFuwQuDVZteCYwr2NsdZuWNkFFRYmiwgP9hkAoS5LQtcZcegAcKaDHYRm5fjQbQnOnbN0FrDLSFtqoTrfXTg7ABK0FUi8VDp+HfiQhsPFYSaQ= x-ms-exchange-antispam-messagedata: DWQuufvT7+yE1dUUDs6piWKxtUCy04bG45jmrMP9bukZun5ZbvWZpDAzMhWfpe8yYuyMlYy/BoKOjKQxYfk4VEn+Mb8BhS4Gkp9iMJHINJZDAdTKkOakGrHV264L1Z6+PB6ujOmCbNN8CQnMsZyMFQ== 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: 9cd0b327-c2f6-4bfc-0531-08d7a408b38f X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2020 15:42:37.4103 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT232 Subject: Re: [PHP-DEV] [RFC] "use global functions/consts" statement From: tysonandre775@hotmail.com (tyson andre) > I still don't understand this logic. If my code is written so that it > needs the current "same namespace fallback to global" behaviour, I don't > care what the default mode is, or how many other modes there are, I want > to make sure that file will continue to use that mode. The *only* way to > do that is if there is a directive saying *explicitly* that I want that > mode. > > In other words, we don't need to know what the future modes are to know what modes we have *right now*, and give those modes names. If strict_types had a name instead of a number, we'd have a similar argumen= t over whether there should be a `strict_types=3D'off'` vs `=3D'default'` and `strict_types=3D'on'` `'default'` is the option I'd consider the best for what I consider to be likely ways php will/won't change. I can > I'm not seeing the downside of adding it now. - Confusion by new developers over whether `'fallback'` is weaker than omit= ting the option. - Obliging future maintainers to potentially support whatever `'fallback'` = would be understood to be if PHP's name resolution changes in a minor way. (e.g. if `count()` uses a keyword that's always the global function, like= `empty()` currently does, as an unrealistic/undesirable example) > The difference is that we could change the default in a future version > to be strict_types=3D1, and people could run code with strict_types=3D0 o= n > both versions with exactly the same effects. That's not the same as > saying strict_types=3D'default'. If php changes the default casting behavior to forbid weak casting boolean = to string or string to boolean (as another unrealistic example), I personally wouldn'= t expect strict_types=3D0 to be required to allow it. In that case, both versions wouldn't have the same effects. Discussions on such a change may reasonably differ in those expectations. > > I doubt that there would be an argument for creating `strict_types=3D'p= hp7'` before we knew what those changes are, > > We already have created that: strict_types=3D0 and strict_types=3D1 can > retain their current meaning, and any new mode can have a new name > (strict_types=3D2, strict_types=3D'php9', whatever). > > > To be clear, I'm not suggesting 'fallback' is added as a third option, > I'm saying we should name the two options 'fallback' and 'global', just > like strict_types has two options, 0 and 1. I can't think of any > situation where I would want a change to the default mode in the engine > to cause my code to be interpreted in a different way, so a 'default' > option makes no sense to me. I have a better understanding of why you're asking for this now, but still prefer 'default' and 'global' for the reasons I've mentioned. ________________________________________ From: Rowan Tommins Sent: January 28, 2020 4:06 AM To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] "use global functions/consts" statement On 28/01/2020 01:06, tyson andre wrote: > I don't plan to change the default name resolution behavior in PHP 9, tho= ugh, > and if it does change, it might even be according to a different proposal= , > so adding 'fallback' as a third option before we know what type of change= is planned > seems premature. I still don't understand this logic. If my code is written so that it needs the current "same namespace fallback to global" behaviour, I don't care what the default mode is, or how many other modes there are, I want to make sure that file will continue to use that mode. The *only* way to do that is if there is a directive saying *explicitly* that I want that mode. In other words, we don't need to know what the future modes are to know what modes we have *right now*, and give those modes names. > I'd imagine the migration to 8.0 and 9.0 would be similar to 5.6 to 7.0 That's not the point; people want to be able to run the same code on multiple versions; the sooner we include a forwards-compatible option, the more versions code referencing that option can run on. I'm not seeing the downside of adding it now. > I see `strict_types=3D0` as similar - The value `0` is currently rarely u= sed compared to leaving out the setting. > If php 8.x were to become stricter about type casting by default in a few= ways, The difference is that we could change the default in a future version to be strict_types=3D1, and people could run code with strict_types=3D0 on both versions with exactly the same effects. That's not the same as saying strict_types=3D'default'. > I doubt that there would be an argument for creating `strict_types=3D'php= 7'` before we knew what those changes are, We already have created that: strict_types=3D0 and strict_types=3D1 can retain their current meaning, and any new mode can have a new name (strict_types=3D2, strict_types=3D'php9', whatever). To be clear, I'm not suggesting 'fallback' is added as a third option, I'm saying we should name the two options 'fallback' and 'global', just like strict_types has two options, 0 and 1. I can't think of any situation where I would want a change to the default mode in the engine to cause my code to be interpreted in a different way, so a 'default' option makes no sense to me. Regards, -- Rowan Tommins (n=E9 Collins) [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php