Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110308 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68790 invoked from network); 30 May 2020 00:21:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 May 2020 00:21:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 293591804CB for ; Fri, 29 May 2020 16:03:00 -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,RCVD_IN_MSPIKE_H2,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 EUR06-DB8-obe.outbound.protection.outlook.com (mail-db8eur06olkn2051.outbound.protection.outlook.com [40.92.51.51]) (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, 29 May 2020 16:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XcIP5/5UEeIGvw/FqFRk9kFeDBYPyur8a+ljojXj787XecJShCV6oUKwLbfXbQeJ5BW60eWEDqREqbaN9LfCURMUZAMiXexnTCWd+GHMy2bME0TJOUIkD5c5kzpWcC6OMW6PgKOo196BPlRJ8ygbtmQVBS9m6FjBdMd3VgVgWNrjpyS1xoMb28/T4oNSzOPckQeeyqQREVD63uDu9geBEGc/Ing8IFvUJTbbeCZEkSt5pjhRn6TOutJSAYhYR2A8ojToGRWBb1eSOjg9vYm0aXl9R79PaStUzAm2HEC6FQ9/x+VLsPAsouf8tShbuS/saphJx5xy5L1I7/IOSvCwIw== 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=VYGVobiTakuzcErBlR6B5To99lqqpRNPg186tKkuEiU=; b=nqAI6DhmU1Q/xNPan7yUP6pHdL8zgBaAz4FWs/RveVuA+Hg2LulwmILa+BIybwkGxpi1Mb4YHvH/z9hdlcWLx6Nb/GWXEStZkmxhAdfyV1NRD2kcl71Fl+JIvNYwcJnGmSU/71Vlblblqbm6/QvM9NKrGs+Vp4lIREH7ka3NHWWCfnwJbyRaM67WbWUxXnceGU0dKU9cobJwz70SJY0bk1GZcT8dwmUdMPTI4kFbPHVtIEYQPzR7S/tbNlsd3zAGIQxDoJcgXtT1Yl4aBMzCR8F129VXqfoVY5XAW5JxbNDco8vUIm2JRMsgFRKXoARxl4cYHqcJhinJj2wqTipxyw== 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=VYGVobiTakuzcErBlR6B5To99lqqpRNPg186tKkuEiU=; b=Cgs7pBVkKYgRDE2XAAEq19w+BQqLtn94q9rR3Kxkjs8VVXQzaqkQUtgXPXme7CVFjMozxw6fjqRmVzKGqmf422sW8EY/p6hZqPAANFiLzW9q5+yloaxzMuEMXagT3NHG1KVvHbgDqTZJXHU6LwaZr3IUOfQ8dTVlw1fzi/ik3Y3eDmpAuPa+v6ckHsVEcErAy1lwMmES1X/O6nN4nUlKBcFuVbyZuV0PuA+dPXROl/cxPRZXGwZMPhfLQxSciyWl/F6qiySU7S5jXFPQt8P+Z7j81xJRzjfw/55gU//iiKg4guSEpZOsK44Am1Pj9FN9ltj60Nm2df4f95jegYUPNQ== Received: from AM7EUR06FT057.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::50) by AM7EUR06HT069.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::488) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Fri, 29 May 2020 23:02:58 +0000 Received: from VI1PR02MB4703.eurprd02.prod.outlook.com (2a01:111:e400:fc36::41) by AM7EUR06FT057.mail.protection.outlook.com (2a01:111:e400:fc36::445) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17 via Frontend Transport; Fri, 29 May 2020 23:02:58 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:49CD89A0038372005D40F7D7B1ECA58F5ED8A3B0D17BE0C7D18D700B3730A8DC;UpperCasedChecksum:B9C39B4DF34933AB7C65393468F094A2938AB721514D7FF0AA3EB56637B0BEDD;SizeAsReceived:7889;Count:50 Received: from VI1PR02MB4703.eurprd02.prod.outlook.com ([fe80::61d8:9f5e:4baf:492d]) by VI1PR02MB4703.eurprd02.prod.outlook.com ([fe80::61d8:9f5e:4baf:492d%7]) with mapi id 15.20.3021.029; Fri, 29 May 2020 23:02:57 +0000 Content-Type: text/plain; charset=us-ascii In-Reply-To: <6f10d1a9-f523-42de-943c-4e9d38f9fffa@www.fastmail.com> Date: Sat, 30 May 2020 01:02:54 +0200 Cc: php internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <6f10d1a9-f523-42de-943c-4e9d38f9fffa@www.fastmail.com> To: Larry Garfield X-Mailer: Apple Mail (2.3445.104.11) X-ClientProxiedBy: LO2P265CA0455.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::35) To VI1PR02MB4703.eurprd02.prod.outlook.com (2603:10a6:803:8f::13) X-Microsoft-Original-Message-ID: <523166F2-D80E-4158-9FCC-4EACEFAAA506@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:7e8:cb71:d400:d059:57ed:6d5a:2da0] (2001:7e8:cb71:d400:d059:57ed:6d5a:2da0) by LO2P265CA0455.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Fri, 29 May 2020 23:02:57 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-Microsoft-Original-Message-ID: <523166F2-D80E-4158-9FCC-4EACEFAAA506@hotmail.com> X-TMN: [s/subODEMy4xE3PMXOLipGS8zkFivbzAsFZlrMUb/SWl4szJxEq2BESkZx3kvt8D] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e721b7bf-1eb2-49d3-0deb-08d804246d45 X-MS-TrafficTypeDiagnostic: AM7EUR06HT069: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pmzrnsl5wpZ21GXPyqVp1+okGjk3BbXGhfFNNF0t9Ub0ExsTmRfu3n9OCEB0BhYIk5XHUXm98DkMZfgSgDitadj9+61tBbGRTCHUeuvVwa2zPe78Medptfg5C+/Vdkf+465BnkV9YEfXnSUq7OPYIofsOs5N8wt5TIxbnNgGsXuMn5QmnYhna9k1aDbpTyCqeKit2SttpEaUHLC3IADoDf0Ny6pOS98t3Efo6Uhkyepj54l5r+TTtyUrHN08lSN9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR02MB4703.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: ojUJLh/H7fXGa1StaZrqpbNR4/+R86bNnwwFpRSauffbxzMkfHWe7AqFCBQU0NWYhaxx59qgoQ+ORKU/Y6zxkbkHFEn9/I/WfUFdt1/AUu+5p+kBoRKYH8jUpDj6KL7ixIl7nbvahqFIfgf6Xyk+JqfZiKneO6Dx/sQLsFd0QGpdxNPJxrU5BAb7eoi2davzjOvcGSG0DdNSIEcTQQ+Krw== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: e721b7bf-1eb2-49d3-0deb-08d804246d45 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2020 23:02:57.7444 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7EUR06HT069 Subject: Re: [PHP-DEV] Re: [RFC] Named arguments From: bobwei9@hotmail.com (Bob Weinand) > Am 29.05.2020 um 21:02 schrieb Larry Garfield : >=20 > On Fri, May 29, 2020, at 9:32 AM, Nikita Popov wrote: >> On Tue, May 5, 2020 at 3:51 PM Nikita Popov wrote= : >>=20 >>> Hi internals, >>>=20 >>> I've recently started a thread on resurrecting the named arguments >>> proposal (https://externals.io/message/109549), as this has come up >>> tangentially in some recent discussions around attributes and around ob= ject >>> ergonomics. >>>=20 >>> I've now updated the old proposal on this topic, and moved it back unde= r >>> discussion: https://wiki.php.net/rfc/named_params >>>=20 >>> Relative to the last time I've proposed this around PHP 5.6 times, I th= ink >>> we're technically in a much better spot now when it comes to the suppor= t >>> for internal functions, thanks to the stubs work. >>>=20 >>> I think the recent acceptance of the attributes proposal also makes thi= s a >>> good time to bring it up again, as phpdoc annotations have historically= had >>> support for named arguments, and this will make migration to the >>> language-provided attributes smoother. >>>=20 >>=20 >> Regarding the question of what to do with regard to LSP validation and >> parameter names changing during inheritance: During internal discussion, >> the following option has come up as a possible compromise: >>=20 >> 1. When calling a method, also allow using parameter names from the pare= nt >> class/interface. >> 2. During inheritance, enforce that the same parameter name is not used = at >> different positions. >>=20 >> This ensures that renaming parameter names during inheritance does not >> break code relying on parameter names of the parent method. At the same >> time, it prohibits genuine LSP violations, where a parameter has been mo= ved >> to a different position. >>=20 >> I've run some static analysis to detect cases that would be affected by = the >> latter check, with these results: >> https://gist.github.com/nikic/6cc9891381a83b8dca5ebdaef1068f4d The first >> signature is the child method, and the second the parent method. I did n= ot >> put in the effort to make this completely precise, so there's both false >> positives and false negatives here. But it should be enough for a genera= l >> impression. And the general impression is that these are indeed legitima= te >> LSP violations. >>=20 >> This approach would be an alternative to either silently ignoring the is= sue >> (as the RFC proposed), or to warning for all parameter renames. >>=20 >> Regards, >> Nikita >=20 > Just to make sure I follow what you're proposing, given: >=20 > class P { > public function foo($a, $b, $c) { ... } > } >=20 > This is legal: >=20 > class A extends P { > public function foo($a2, $b, $c) {} > } >=20 > // Mean the same thing: > $a =3D (new A)->foo(a =3D 1, b =3D 2, c =3D 3); > $a =3D (new A)->foo(a2 =3D 1, b =3D 2, c =3D 3); >=20 > This will parse error: >=20 > class A extends P { > public function foo($b, $a, $c) {} > } >=20 > Am I following the intent correctly? >=20 > If so, that sounds like a very reasonable and safe middle-ground. >=20 > --Larry Garfield Yes, that's pretty much the intent - having a very small BC break surface, while= still allowing for safe usage of named parameters according to both the ch= ild and parent interface. Bob=