Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110919 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9547 invoked from network); 10 Jul 2020 15:27:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jul 2020 15:27:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9EF88180088 for ; Fri, 10 Jul 2020 07:18:56 -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_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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, 10 Jul 2020 07:18:55 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id g75so6337054wme.5 for ; Fri, 10 Jul 2020 07:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IVx8Haq3/kDjhJsuTqXABC5nUGQJQyaJgcPGx/tE7t0=; b=PygFWiM1TGyNjuMnc2nszYkj6hDvvRh2ocJ5JIj9cSutuMEuztiAZRO0FNEoOEZOd0 1fCInkdrKjmhMcr9ElqQCM2U9vWkO7+08X2wuCrE+5HdC0xQH2FsO0rRd5iUmMGyezhn q4DJMLBX/uhAlkfdgC3CfTB/Pa+ZATED3jgM3FHipSKSAkDC4cibzSYU0W4UdYYWn1p5 iEfM4dECjhbvpbKD25fv9ZAy/NoNWJ3ar5GFuyCgOQbIfzJVpG3g/jFdrcXp5IOAtRqp y1FY/dd+UlsvwASzkHBpncl0hcSWYsWTE9p8L90Pp1FW7sr9RKiEhRmwf+2c6FaZn26B NwFQ== 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=IVx8Haq3/kDjhJsuTqXABC5nUGQJQyaJgcPGx/tE7t0=; b=WwtbqiZ4EUNb/KkHVhtAo22d5uoHuT0xpp0AWZN2MuVTTgCbPPvfpa9flDoQmxfGD6 l744Zy+Gqa6J146WNrLDr6hloIIWSVOfqDBd5WgYqMnW1h3LY8Q4apMkwxe2jX+Ofukn K5byq4SeJXzvIH07INgMluUYtXgG2awHhHLup+46MXDOhDAbWmFOyjxWMDprxmEI71GO 1IXSrcPo8sxRPGUwDMFfLOghpcYAox22Poxtt3aZ21d0dd2hZPes2C37EUFP7ToQx2Tf nknQHzOsN4craSVqEu+b8NSjBfm/5F0GZlkUrS4IaQ5H0ZQ7PFOzFH6kllpWIT+FzL7u 2EVg== X-Gm-Message-State: AOAM530GRRuoUQGaQ1EibLZWnLz51g0MnIKUi02KDo3I/6It6Kpxm/mv lE1fB2rBrgKYWNISwagcuGgZX6wbMuBV1Wdrmte5gw== X-Google-Smtp-Source: ABdhPJxa4+JKf1KN7yzQlu4JVv8OuRqLd+WYNgh6tzkrf0/ecaymUWWQTbf6fX7o2uZBRoYuFzjXiWVXjQYw42BGGpw= X-Received: by 2002:a1c:4c0a:: with SMTP id z10mr5709748wmf.38.1594390731933; Fri, 10 Jul 2020 07:18:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 10 Jul 2020 16:18:40 +0200 Message-ID: To: Marco Pivetta Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="00000000000035df5005aa17058c" Subject: Re: [PHP-DEV] [VOTE] Named arguments From: kontakt@beberlei.de (Benjamin Eberlei) --00000000000035df5005aa17058c Content-Type: text/plain; charset="UTF-8" On Fri, Jul 10, 2020 at 11:21 AM Marco Pivetta wrote: > Hi Nikita, > > I kept my "NO" stance here, as per discussion in > https://externals.io/message/110004#110005, where I provided (in my > opinion) good/safe alternatives to arrays as input parameters. > > The BC implications on this RFC still largely outweigh any advantages that > it brings, from my perspective. > Are there alternatives to named parameters? Of course. Are they as simple? Not really. 1. You can use an array, but array values cannot be typed, so you completly loose typing of the language. 2. You can use an object with builder pattern, but that requires a lot of code to write, and increases the mental capacity of understanding something for developers. 3. your example of an api to convert named params to a sequence is not discoverable, you don't know looking or using method A() that it comes with an additional NamedParamsA() helper. I see PHP as a language to get up and running quickly. So builder pattern is really more an advanced approach, should be used by not many use-cases. We have seen arrays of $options and $params to no end in framework and library APIs, with all their problems. So named params are a real improvement that feels like supporting "the php way(tm)". Lastly we need to consider internal APIs, which are usually about adding more parameters (htmlentities, json_decode, ...). These APIs are going to stay and benefit hugely from named params. Then the question becomes, do we rename parameters a lot? I doubt it's a large problem, and even then the variadics support makes it very easy to handle in a backwards compatible way. In addition libraries are always open to declare they don't consider named parameters as part of their API. > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > > On Fri, Jul 10, 2020 at 10:42 AM Nikita Popov > wrote: > > > Hi internals, > > > > I have opened voting on the named arguments RFC: > > https://wiki.php.net/rfc/named_params > > > > Voting will close on 2020-07-24. > > > > Regards, > > Nikita > > > --00000000000035df5005aa17058c--