Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110090 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23253 invoked from network); 8 May 2020 19:28:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 May 2020 19:28:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2369F180549 for ; Fri, 8 May 2020 11:04:28 -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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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, 8 May 2020 11:04:27 -0700 (PDT) Received: by mail-wm1-f54.google.com with SMTP id h4so11089504wmb.4 for ; Fri, 08 May 2020 11:04:27 -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=4jBc85n1AkxKHI8kWqWWUa3exVL5n1lxJmKTihdN4mQ=; b=Bei4HgKCIWpb4xl/FHcuaTXf4jFijXJUd7LjHX8/w9yePSQ76ImASEVpgZmVAKvpfS SgXMCOoz/NSKagyjNoaSiIGD3tannGZA94OQVC8Sl+os7hLHlIEVLItCGmFFpHftBLIX LKdqDZJAF3Ou4ncXxpk/esycTkFf4K7mBVn8cQ9P0TfpR+G3qVGFl2iPFwdtX80r72OM 1Q1xkBIyzARWOSUojBFLCLlLpZc2NKVWk+C+54BQc0f9bD4OU3bD79SYDhR1RW7TxVAz G4AVYREZviP9QypM++VDXXyov8OZ31STgQN3CfiPgHNP0oYdqK1TxjZwt1pZexyfv0+/ IBKg== 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=4jBc85n1AkxKHI8kWqWWUa3exVL5n1lxJmKTihdN4mQ=; b=jOl4/B5DAAnTPImzMJLcPUPnAnKjeoPDCgRu6MEsRU5plKtP22i71tVyHUlChullCz ePmOnvTClaxNnc+Jm8Qog6/v9AaBCg+BwWjdDEnjop4jjbS8DdrW5ATLzEMnAj2AUzOE VwBsJ9x9cf3pWyogFI2ozhZFWQnKGxciuLC6ImaOALa2AtlOSnUGsakRVsElnB3VULFc 0sDy5QLAlOl5u6nDLb8iyWdqSgyViaML0oF+idJgrEgsy3b/5t2YtcJ2bu1JM82VNiL+ QH/CmGY0bgZeTvM4EtykF6SNm57J3cZf6o1RzMY3e+Qrl7UiCwBjxRcl+89lYobuDzSH 1RzQ== X-Gm-Message-State: AGi0PuanTNbR26GrRd+e3VhPzxRx/Kq2u4HwPuAP/T+/yKvY4/acOe7k e2e/AkYDESbpqPTdc1U0XilK6t5Y X-Google-Smtp-Source: APiQypIJKw3op/k2jXmvRnyZ0fH/Tweh2ObMWJf7Uqrz1r4MDQ2kA9oGZmQKeOxZ2T3xwbZNvz6V+g== X-Received: by 2002:a1c:9c15:: with SMTP id f21mr17446672wme.139.1588961064413; Fri, 08 May 2020 11:04:24 -0700 (PDT) Received: from [192.168.0.14] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id y7sm14746850wmb.43.2020.05.08.11.04.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 May 2020 11:04:23 -0700 (PDT) To: PHP internals References: <1C09C0A9-1DA4-4753-8E5A-A739D52DA0B3@newclarity.net> <54c5f8f0-1526-53df-0912-0b00e0e54bc3@gmail.com> <44B0AB58-2993-403F-B75C-124AB26B6875@newclarity.net> Message-ID: Date: Fri, 8 May 2020 19:04:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.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] Parameter Blocks (vs. Constructor Property Promotion and Named Parameters) From: rowan.collins@gmail.com (Rowan Tommins) On 08/05/2020 02:32, Mike Schinkel wrote: > 1. The proposal on the table for Named Parameters effectively converts > all parameters names into public aspects of the their function's API. Yes, an opt-in version of named parameters might be useful. However, I'm not immediately convinced it should share any syntax with property promotion; the only real connection is that we're discussing them at the same time. > 2. Adding the ability to fully parse all features of properties and parameters into two different contexts each with their own syntax variants will add ongoing maintenance burden of core (or at least it seems apparent that it would.) > 4. Who knows what syntax contortions will be required ... > 5. New features for properties will likely take more discussion time to determine acceptable alternate syntaxes ... The only reason I can think there would need to be variations in the syntax would be if there was some new syntax for properties which used commas in a way that would be ambiguous in parameter lists. Otherwise, parsing a promoted parameter is exactly the same as parsing a non-promoted one, but you stop at "," rather than ";". > 3. The alternate block syntax would simplify userland refactoring to move properties to parameters and back... > 11. The current Constructor Property Promotion adds complexity to the language where there is no analogue elsewhere PHP By its nature, this proposed feature is merging two existing syntaxes. The current syntax proposal looks mostly like the constructor's existing parameter list; yours looks mostly like the existing property declarations; I'm not sure either is automatically better. Switching to or from promoted properties will always require changing one or both parts of the class - the largest edit will be deleting or re-creating the body of the constructor. > 6. Userland tooling would need to support both syntaxes... > 7. Userland developers will be confused by and have to learn two slightly different syntaxes for essentially the same (type of) thing. These points are both true no matter what the syntax looks like: it will be a new syntax, for a new feature, and tools and programmers will have to adapt to that. Glancing at the implementation on the RFC, the changes to the actual PHP parser actually seem fairly small. > 8. I believe this alternate syntax addresses Michal Bruzuchalski's and Larry Garfield's concerns... > 10. Nikita claims there is a "line" to be crossed when property declarations have their own blocks and would disallow their use with CPP... I hesitate to speak for them, but I think their concerns are more conceptual: that this requires nesting a large portion of the class definition inside the constructor definition. Changing the syntax doesn't really change that - the "parameter block" would still be an extra level of nesting, attached to the constructor definition, rather than at the top level of the class, where it lives today. > 9. This alternate syntax would reduce the desugaring required The compiler won't need to transform the actual source code; the "de-sugaring" is just a representation of the _equivalent_ code if written manually. > PHP is primarily a line and block oriented language, and CPP purports to add Javascript-like complexity into a single statement. I'm not sure what is "Javascript-like" about the proposed syntax, or why using semicolons rather than commas makes it less so. Regards, -- Rowan Tommins (né Collins) [IMSoP]