Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111178 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43306 invoked from network); 24 Jul 2020 17:19:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jul 2020 17:19:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 93DB5180545 for ; Fri, 24 Jul 2020 09:14:17 -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,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jul 2020 09:14:16 -0700 (PDT) Received: by mail-oo1-f46.google.com with SMTP id y9so1909045oot.9 for ; Fri, 24 Jul 2020 09:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2goOd+c+E8xlC0RIDBWHPKd7bU3S51r+pQbJHY/A4ts=; b=MA14hbzs87txWntVjb8wsdA9hAhOuZYMT5vzi7m3X/GY5pVz5SRua+35+eYQ+dh3XH wfuB1iK4sg7Vy1hq2jaJvA64VNDjgs+R4QbGGIYALG7DYGwA4/IDLyQ694ioFc1k6pbN P7LUO/IAETcwofkFoLGN2ONZdtXE/SbmgRcaXrKAtEvpyVmhAmp/TQLzgvPOSsTNq9NM IYMHbF5AXdMkJ7Qf8Nrq+5DxsQfMGJagQc0kNvO5MiM8MgBcDJcntueKTuOeP63eA+8t VsbU1KH4sqpPiBqOf4jZq4sg4Vuf8NxbAfXaOZnydx7oYrp/t9zY085PH//LqI9ctB+e PI7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2goOd+c+E8xlC0RIDBWHPKd7bU3S51r+pQbJHY/A4ts=; b=ASJoR6jiLrFm/6299+amE8S9Z4TKLNoE0jA7akDAXBMbB8AdJMHsRd52dI+yMAgEYg WimpDWUt0ctNXbwgMT9y6I6r+LGIgziMjh+lE0f2FhUTEJMNv4oZL2SLLd99BQh0lzPa WMtwHD/vT4duP5spOyjqchSHv2Udd7WFqUDqWFSH5UscAkSlpke80FuZ2MZeccGKOrXD H/MagHtXm7M3JEgWnk/At/ER5jwwkTakm4d0EIitA6v4sa513XlUZuWb40MwI3QIhKLZ 5sMPXqY0wOvIOqEaKjaZ4YgcvAWejRrv+3iQp9nr+xxY6eOppEKttnKE8ZWkALL3744C n0Uw== X-Gm-Message-State: AOAM533zGFMoFhLzxN7P+Ybhl8UpTZNbxCh5FIsZujLWEDtFONJYs4F5 vPrV6Jm8QnRPTf2KcF4EMM0zzDUJWzkEMY3XVoyh5w== X-Google-Smtp-Source: ABdhPJxXpv/EXGAOn2NOU/w1qUCzuE2hBn4glM3Oc5rqiQKMrB96sYenNEJszWLYruHCOo6uLwL/YeVH7p21wxmbhuQ= X-Received: by 2002:a4a:3443:: with SMTP id n3mr7229053oof.30.1595607254464; Fri, 24 Jul 2020 09:14:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 24 Jul 2020 18:14:03 +0200 Message-ID: To: Sara Golemon Cc: Nikita Popov , Bob Weinand , Benjamin Eberlei , Chris Riley , PHP internals Content-Type: multipart/alternative; boundary="0000000000009a8eba05ab3243cb" Subject: Re: [PHP-DEV] [RFC][Proposal] Renamed parameters From: andreas@dqxtech.net (Andreas Hennings) --0000000000009a8eba05ab3243cb Content-Type: text/plain; charset="UTF-8" TLDR Only consider parameter names from a type-hinted interface, ignore parameter names from the actual class. ----- I had a look at https://wiki.php.net/rfc/named_params#to_parameter_name_changes_during_inheritance Indeed I have concerns about this, because a call with named arguments would make your code incompatible with 3rd party implementations of the interface that do not keep the parameter names. I would see this as a flaw in a newly added feature, which should be fixed during the feature freeze. I might even say the current version as described in the RFC is broken. I have no objection to the OP's proposal, but would like to add some alternative ideas to the discussion. My first idea would be to only consider the parameter names in the original interface, and ignore all renamed parameters in sub-classes. This would cause problems if a class implements multiple interfaces that declare the same method, but with different parameter names. So, a better idea would be like this: - The variable must be type-hinted with an interface. E.g. as a parameter or as object properties. - named arguments always use the parameter names from the type-hinted interface. This would need some static analysis at compile time, and we need to be able to type-hint regular local variables. An alternative would be to somehow "import" the parameter names at the top of the file, somehow like so: use Acme\Animal::bar; // Parameter names from this method will be used. (this syntax probably needs more thought). Yet another option would be to somehow specify the interface in the method call.. ((\Acme\Animal) $instance)->foo(a: 'A', b: 'B'); Regards Andreas On Fri, 24 Jul 2020 at 17:41, Sara Golemon wrote: > On Fri, Jul 24, 2020 at 10:10 AM Nikita Popov > wrote: > > > > You added PHP 8.0 as a proposed version, but that will not be > possible > > > > anymore 2 weeks of discussion + 2 weeks of voting are not possible to > fit > > > > in before the feature freeze, which is in 11 days. > > > > > > While you are technically correct, the primary point of a feature > freeze > > > is not allowing in completely new features. > > > It will always happen that there are changes and extensions to RFCs > > > introduced for the next version which may need to be addressed first, > > > because there is massive benefit to the new feature in that case. (from > a > > > backwards/forwards compatibility standpoint for example) > > > > > We should of course be open to making minor adjustments due to > > unanticipated issues after feature freeze -- after all, that's where we > > gain experience with new features. The emphasis here is very much on > > *minor* and *unanticipated* though. > > > > Endorsing this. Anything post FF needs to be held to a high standard. > Minor and Unanticipated changes. > * The option to set alt-names on parameters is substantial. > * Making named params explicitly opt-in is less substantial (though > certainly not trivial), especially if it were hung off an attribute which > would mean no actual new syntax, but Niki's point that it wasn't an unknown > or unanticipated issue stands. > > I share OP's worry that this pushes workload onto library and framework > maintainers, and I wouldn't look forward to the review of all APIs to make > sure their names are correct, but the vote has spoken. We should > absolutely continue pursuing this topic with an eye to 8.1 so that library > updates are less painful moving forward. > > -Sara > --0000000000009a8eba05ab3243cb--