Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110015 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85078 invoked from network); 5 May 2020 18:53:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 May 2020 18:53:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3EDAC1804F3 for ; Tue, 5 May 2020 10:28:03 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 217.72.192.0/20 X-Spam-Virus: No X-Envelope-From: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (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, 5 May 2020 10:28:01 -0700 (PDT) Received: from oxbaltgw65.schlund.de ([172.19.246.152]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MHX3X-1jIWy61FnV-00Db1C; Tue, 05 May 2020 19:27:59 +0200 Date: Tue, 5 May 2020 19:27:59 +0200 (CEST) Reply-To: Thomas Bley To: Marco Pivetta , Nikita Popov Cc: PHP internals Message-ID: <770955649.245407.1588699679171@email.ionos.de> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.1-Rev30 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:fCnfxMpZttKs4RVCoQV+vuY9lnnQ83N+yib61O2VK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zWX52+N5vLlS4RK0rmSIrD5NajBphe097rnzVLXVfUtaFT/0obbEn6W Subject: Re: [PHP-DEV] [RFC] Named arguments From: mails@thomasbley.de (Thomas Bley) > Marco Pivetta hat am 5. Mai 2020 um 16:11 geschrieben: > > Hey Nikita, > On Tue, May 5, 2020 at 3:51 PM Nikita Popov wrote: > > Hi internals,> I've recently started a thread on resurrecting the named arguments proposal(https://externals.io/message/109549), as this has come up tangentially insome recent discussions around attributes and around object ergonomics.> I've now updated the old proposal on this topic, and moved it back underdiscussion: https://wiki.php.net/rfc/named_params> Relative to the last time I've proposed this around PHP 5.6 times, I thinkwe're technically in a much better spot now when it comes to the supportfor internal functions, thanks to the stubs work.> I think the recent acceptance of the attributes proposal also makes this agood time to bring it up again, as phpdoc annotations have historically hadsupport for named arguments, and this will make migration to thelanguage-provided attributes smoother. > As mentioned some days ago, I see named parameters as an added liability,rather than values.The rationale of my negativity around the topic being that a diff likefollowing is now to be considered a BC break: > ```diff-function foo($parameterName) { /* ... */ }+function foo($newParameterName) { /* ... */ }``` > In addition to that, the feature seems to be especially designed to workwith particularly bad API (anything with a gazillion optional parameters,such as all the OpenSSL nightmares in php-src).In practice, the issues around bad API (in this case, bad = lots ofoptional parameters, maybe even ordered arbitrarily) are fixed by usingproper value types and structs or value objects: > ```phpmyHorribleLegacyAndOrganicallyGrownApi( > ...MyInfiniteSequenceOfParametersAsProperValidatedStructure::fromArray($stuff)->toSequentialParameters());``` > For the few use-cases where this is needed, the userland solution seems tobe sufficient, without introducing catastrophic BC boundary expansions. > Unless I'm not seeing an incredible (hidden, to me) value from thisfunctionality, this is a clear -1 from me. > Marco Pivetta > http://twitter.com/Ocramius > > http://ocramius.github.com/ Hi, I think it's a valid point that changing parameter names can be a BC break. In case the type declaration or the semantic of the parameter changes, it's good to let the code break. I guess that tools for static code analysis will be able to detect parameter name changes? Regards Thomas