Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111201 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5563 invoked from network); 27 Jul 2020 19:44:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jul 2020 19:44:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AE5E61804D0 for ; Mon, 27 Jul 2020 11:40: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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 ; Mon, 27 Jul 2020 11:40:17 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id r12so15840719wrj.13 for ; Mon, 27 Jul 2020 11:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=LI3H53jf4nzPEr398RbxzVm20oRoZMZRHPxlXbM4/6k=; b=uonDr0GI7PkFVNQJ4LFVupfBQgB3wQ4PHbObxk4iNxnvhbanlik3QUbv2v/0dVy2Qn Osri7sowlqPzyONG4klXO7vFHUR/3sBFIlEBwXxNbXt/UfX6aCyKrZs21h496ydQdjim mJ24wzGfc9ebjF6aAvEaR2NtgyJxzukKWziQwZ+ozB+qeEfw2O1UnIuP3imbiaImIobF /C3L9BRuRPhFUK56hbBaAt2MPB/h+wa5e2OfiGHDcAFPOuZ5vfgvsoAXveDNWYnruInS gFxrNiHgWYYBuB+eufda0Om/tJGRCq3gUcs9ul/ICx//9WOIJHo/GoGlY47e/fW/qyhV URjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=LI3H53jf4nzPEr398RbxzVm20oRoZMZRHPxlXbM4/6k=; b=CkGnjCO5JKzNSrPUtANQEhn/jB0+uJTdN2+LLz47xhd6jg5Vj97sG/ChGFIPgAdYW3 aH4tuzDfPXaHXkWJJ5BGpCEZqDpdguRdyxJQHlEX2OUcbIHYKo3206Ff6bfeLCPni6s9 ZO8ut7ohVmFx9hdlnNttXG7xpB3biR/ia3z0iWAD/TwxT6hilMBJuFp9LrGR7cbhUmfW j2Pk5rNYLZ9Vh8NtuZIRTHzTDoekouvdFS61ftNT+ZjunlqgH7m68W+PwyDAXE4zhCxV jnfCMrTd5A/+GP10J0BiLO824poIcH2dl2LAFcqcX+YywcZDrEEG0WKtqZJMwHLqoFBn RHpw== X-Gm-Message-State: AOAM532VudvbgQ6u/pyHZbkgVk549IQYvawACNymbtYwmOhEq4G064Mk 7g4flI0cMzmlFO2M+V8jSoboTxkn X-Google-Smtp-Source: ABdhPJw8/W3lAtKnma7b9/gd9+X3J6FnUOmMNUYBNnqaHyqQFmgr4cwdRGQsImZAWtOKThrvx9hjEg== X-Received: by 2002:adf:a15c:: with SMTP id r28mr21418766wrr.151.1595875214572; Mon, 27 Jul 2020 11:40:14 -0700 (PDT) Received: from [192.168.0.22] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id k10sm13348426wrm.74.2020.07.27.11.40.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2020 11:40:13 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <0836b5cd-ec21-c383-4f68-0cabaf1adaf6@gmail.com> Date: Mon, 27 Jul 2020 19:40:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC][Proposal] Renamed parameters From: rowan.collins@gmail.com (Rowan Tommins) Hi Andreas, On 27/07/2020 00:41, Andreas Hennings wrote: > 1. Calls with named arguments can only happen on: > - explicitly named functions (e.g. no call_user_func()). > - constructor calls with an explicitly named class. > - object methods, if the object variable is type-hinted or a type is > known at compile time. > 2. Named arguments in calls are converted to number-indexed arguments at > compile time. > 3. Parameter name lookup is done based on the type-hinted class or > interface. Parameter names on the actual object are ignored. While this is an interesting concept in general, it introduces a much larger change to the semantics of the language than seems justified for this particular problem - it would effectively require introducing an element of "static typing" into the language. By "static typing", I mean this: > variables have an intrinsic type, and the same value can behave differently depending on the type of variable that holds it Which could be contrasted with "dynamic typing" like this: > values have an intrinsic type, and operations will be selected based on those values, regardless of which variables hold them Although we have various type annotations in the language now, they are all just restrictions on the types of value a variable can hold; they don't change the behaviour of that value. With this proposal, these two function would potentially do different things when given the exact same argument: function a(FooInterface $arg) { $arg->doSomething(namedparam: 42); } function b(BarInterface $arg) { $arg->doSomething(namedparam: 42); } Static typing of that sort is a useful feature of other languages, and there are people who'd love to see PHP go that way, but it's not something we should bolt on in a hurry just to solve an issue with named parameters. Regards, -- Rowan Tommins (né Collins) [IMSoP]