Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111192 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11621 invoked from network); 26 Jul 2020 17:41:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Jul 2020 17:41:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D82B71804DA for ; Sun, 26 Jul 2020 09:37:16 -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-Virus: No X-Envelope-From: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10olkn2042.outbound.protection.outlook.com [40.92.42.42]) (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 Jul 2020 09:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mbHjYXmw/48bMdGzBL5VJOXua1pmPQqR5YHqrQATqWaPvMGg4kcV6GxjR0E7YTp+4eAGG+KYSLO/NuUDEyNHc3Nn32v3UhKAf8BISXKCj4A/W3hqyQ716EvntBhDs1iwWE7KUHCYdv2lS5xDnFnr31cqkZd3pIGZkeD3UIbPN/imWEoEghvdNCFKaIYvM4SEcGh+y4/jAhcYPX44r3cYGG2X7B5ih74T0EzZYtJUJw9R8ffzVqxNG9NuXKwq1h1pHBVExFb6z9/0C+HUC4yCDK1S6aUo0WKn0/rmIEkzZh5Q1rF5IEz50t6usJzNbXxF5TMfQtfkxME5MPnnEuhy6Q== 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=Ytq5FAgBNCjhW8KKbCdzgjfLwzINIdJWNb9+y66J9fw=; b=oHIgLaGtkZJ2RMgq1g1XCUFU7Do+I8bB+rpAojaCmUAJ/qrjEqTknoRktxUgHJnSmXpSo3PrF6ki7rUpWFjHXPLo38o7fUYRu/QHASBv9QbmTsF1f8LO0MMG80lcW0lK/I5hqtk+CLplXJZmIPufU0m1hecUDxZnPdCq3hrVPxiD75KFh3TP0l/f5p5ONAmw6PqTMo+1NgpvUb7sJtcVR0WGJujuMa0SKYCYk6WI0GmP12op0dkraU/VmbZskfDB1Zht0s+m4dtTnWHOqWt8OIy/IBmxQ8UjI9ynKOXS2p63Lu3T9Q0a2fVGKl9wkw/RtA1tL8fotsZVxumNJiqsBA== 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=Ytq5FAgBNCjhW8KKbCdzgjfLwzINIdJWNb9+y66J9fw=; b=oBm6CpvzpGJTn1+ng7YP782E/7lupq5845Ng4EPHa+rIYW1OL7wJ67qI5I5qCyWjVBs8xfMIpKibvu+bogLuN4iUmczT/NfJ8nEnEr6wWDhCx+WSCuS5DYhE4wbGfQjcYwGlRi4ZLsOc3PpDz4Ne5Ld0Z2Z9Ve3nheNEu1Pu9uA0caSybXe5VNmsz9XoSzDBr48U+T6L9GgWPSERak/zhKip6zTUsZZAqNwQFjAJsl+w3tGG6jeA3gqsCotEUctSYRUwxBT/fsa49LdVNZcT206/gUu2LANR5UzrbyFK1EpQGnWHH6lJ98hu3hPbKKZNbN1+hW0Y/li6f4jgUy46Jg== Received: from DM6NAM10FT010.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::4c) by DM6NAM10HT060.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::256) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10; Sun, 26 Jul 2020 16:37:14 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:7e86::4f) by DM6NAM10FT010.mail.protection.outlook.com (2a01:111:e400:7e86::472) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Sun, 26 Jul 2020 16:37:14 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::cc10:a3e2:1dcf:adc1]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::cc10:a3e2:1dcf:adc1%6]) with mapi id 15.20.3216.030; Sun, 26 Jul 2020 16:37:14 +0000 To: Chris Riley , PHP internals Thread-Topic: [PHP-DEV] Re: [RFC][Proposal] Renamed parameters Thread-Index: AQHWY1QGV6S1Us1HE06xDv4fiLJYpKkZ/voK Date: Sun, 26 Jul 2020 16:37:14 +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:C9961A2A3C7DEEE738612DB9415767C0EBC2BF8104E52A57C76A034AB8ED54C8;UpperCasedChecksum:A0B2CC1F0D3100C3E1FF65AED4E32EC00EEB08B76EEDB3F00E129B5413C35120;SizeAsReceived:7142;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [7mhpNAcdq2ovnkoaa+B7Jv5hjzQR7qwXq2CVDJMsPbE24W4YYWj8j8wZPom8NGm+] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: c277b3dc-fe92-4f70-fe7b-08d831822703 x-ms-traffictypediagnostic: DM6NAM10HT060: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: orq2P2r+iDZM+5qZl0IG/0ZX1CkqC4G1E9RWmbvfJ7mwLrUyYd1ehQ75JiMSLez/Oe6RfLscljqQmFHz1A0OcnKw+l7pCfbR8tlgDt2KSS4u2B2TMLwbam/NCbar+H/sIm+/f7Dz82yOS20NHlVdE76ZOWVS8gOz49n5stP1TQCEYUnMfEVMzEq3I+7n0ZpZ8BWlQKYuT5r4eUikqZHTrxKHy1uC+N2w9LmF1EfX9lJsVfySFUau/vQGB4OEVACv x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR07MB6618.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: KBef0kK8rnQFpf1Os5bI+Oy5O1sojUTU/SURw4ujsxIhfA4zsKCtkZ5rTAh7ziLBn7YPXZTtCdbIYsFS6v1WQ9fAXHIgJJjBktfYzZolltwb31TZqPR7XfpXqv/PErX4JN4BhMqo3eMN6a7Fm1s0X4NRbEX2iXOJQSg1PUrnlXY1tCeZCwhjBIlRVKaWtdx/mcND67rcowpBKdkHd+2bzg== 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-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT010.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: c277b3dc-fe92-4f70-fe7b-08d831822703 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jul 2020 16:37:14.2108 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM10HT060 Subject: Re: [PHP-DEV] Re: [RFC][Proposal] Renamed parameters From: tysonandre775@hotmail.com (tyson andre) Hi Chris Riley,=0A= =0A= I agree with Rowan Tommin's arguments in https://externals.io/message/11116= 1#111179 - I wanted named parameters by default.=0A= =0A= Miscellaneous comments:=0A= =0A= 1. https://wiki.php.net/rfc/renamed_parameters should be moved to "In Discu= ssion" on https://wiki.php.net/rfc/=0A= 2. I think that the RFC title should really mention "Making named parameter= s opt-in",=0A= since that part of the RFC has the largest impact.=0A= (e.g. "Renamed parameters and making named parameters opt-in").=0A= (The RFC URL should not be changed)=0A= 3. For your examples, I assume you mean "Class Bar extends Foo {" instead o= f "class Bar {"=0A= 4. "Error: cannot call parameter $externalName by name." seems incorrect,= =0A= I assume "cannot call callBar() with parameter $externalName by name" o= r something along those lines was intended=0A= 5. https://wiki.php.net/rfc/renamed_parameters#attributes still mentions "o= ption 1" and "option 2", but those were removed from the current version of= the proposal, making this confusing=0A= 6. How will this RFC expect internal functions such as substr_compare() or = internal methods such as `ArrayObject::__construct()` included in php-src?= =0A= =0A= What about PECLs - will existing function declaration macros be treated = as opted out of or into named parameters?=0A= 7. This is missing some details on how reflection and backtrace generation = will be affected.=0A= I assume `ReflectionParameter->getInternalName(): string`, `ReflectionPa= rameter->getExternalName(): ?string`, etc. will need to be added.=0A= getTrace() and getTraceAsString()=0A= 8. Renaming parameters offers only a small performance benefit and I don't = think it would get used very frequently.=0A= It's possible to add `$newName =3D $oldName; unset($oldName);` (or in m= ost cases, to update the method implementation body).=0A= 9. Are declarations such as `function test($:publicName, $nonPublicName) {}= ` an error?=0A= =0A= I'd personally prefer https://wiki.php.net/rfc/named_params#positional-o= nly_and_named-only_parameters to allow API designers to explicitly opt out = of named parameters.=0A= 10. As Rowin Tommins had said, "maintainers of larger OSS projects" is a br= oad claim and could be clarified=0A= (e.g. what fraction of maintainers? Were there polls/discussion threads = of maintainers/owners of OSS projects?)=0A= =0A= Since there are strong objections from some maintainers of supporting alway= s-enabled named parameters,=0A= I'd think a useful alternative would be to add a positional-only parameter = syntax instead in 8.0, similar to what Python,=0A= so that maintainers that want to avoid supporting named parameters in their= API can clearly express that in a release requiring ^8.0.=0A= This is using syntax for https://www.python.org/dev/peps/pep-0570/#history-= of-positional-only-parameter-semantics-in-python for clarity,=0A= but obviously other syntax might suit PHP better.=0A= (mentioned in https://wiki.php.net/rfc/named_params#positional-only_and_nam= ed-only_parameters)=0A= =0A= ```=0A= function test(int $x, /, string $y) {}=0A= test(x: 1, y: "test"); // Error: test() does not support being called with= parameter $x by name=0A= test(1, y: "test"); // allowed=0A= function test_varargs(...$args, /) {}=0A= test_varargs(x: 1); // Error: test_varargs() does not support being called= with named variable argument $x in ...$args=0A= test_varargs(...['x' =3D> 1]); // Error: test_varargs() does not support b= eing called with named variable argument $x in ...$args=0A= ```=0A= =0A= There may be concerns such as whether `/` can be added when overriding,=0A= or in forbidding using `...$newArgs, /` to override `...$originalArgs`=0A= but since parameter renaming was already allowed in the Named Arguments RFC= this should not be a new issue.=0A= =0A= Regards,=0A= - Tyson=