Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125227 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 666B21A00BD for ; Sun, 25 Aug 2024 17:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724607173; bh=L6uRQI57MRkXQvFGKMdiJB35N8eKbUdfuNyGbwfGG4o=; h=Date:Subject:To:References:From:In-Reply-To:From; b=laCoaSaxZZSxhOL70G+bJ/9aCJA3gAoJn4vZKc4Ma36AzDxvMzwyW4dD+DX5BiVRi Rl78PYdAx1MVyi8cH7SUrvHsDSElauRbYz5JRJCe7o6XOOmNAx1pnliwunMdk1UI8z 83Eifj//wvtvgPoUIrMtpCElk/5byjuVNc/eQfZLgqMs8S/TbWOqXoY0GGQ5BCaAKY fjvLpw3kSYJTBKTPhWUtqP8KlfVW1y8ibrU8/wfTCmXUnG5CKcIIpM+hCYIxJQHe0m iiDek1CmN3yvGeVNs/lkrAtYV54xOZtf1L8s+l4VfcSrTDOK9UWmMGJqVmNW1khibk /7CXGr8zmxGtw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 95261180086 for ; Sun, 25 Aug 2024 17:32:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 25 Aug 2024 17:32:52 +0000 (UTC) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42817bee9e8so30628465e9.3 for ; Sun, 25 Aug 2024 10:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1724607058; x=1725211858; darn=lists.php.net; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=2CQIow27TUQSlMv1INTFvkFm/QugIRkQyCQwKJGCr+Y=; b=oFVAHCv9qSwBP1eEZSFdDPOQD2b58Y7sEcB0iHqxqpgMPAdVWh+M7JYxBFoER2x8zw cYRId/ED1irtqyBKX1OpciwtvH3IM67qhnnUnilhY0epkgE1WWlXflpWmG5i7qYrLtwn okg11laubWwDlsuCOhXxHGJnNT1gI6YzUZL/mNtZQyB+JmWgPQKEVf4S/8sYj+JqIKDz a/gYd6QgnnOFRhAxSitYVDbWIOZXmb9VLUp4rYaVhDoSMX9cAoLyv8k2JSwi0RiEwOm1 fGh4a7zpE/HyFfT1+Mc6t5/bvzPTuiafe9YETiuxMPqgbrlTEYUdGdrORRwpPIMgVx1E lkzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724607058; x=1725211858; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=2CQIow27TUQSlMv1INTFvkFm/QugIRkQyCQwKJGCr+Y=; b=Tn/7B3zgrpZHSvtDWE8rSApHZka2CxE8sn2zx3Qi1GuBsuEuziWACIap9HBxBBPHv8 fdfhy+Q8hlTZGBPxzNZXBA60euDuV8KjdyR+3xvM4KWD20YghEeDNK0KyDfOyf7avwhc cVgcMq6h+sdF8/XnKarRbnBqPaRx+OmMe0I6qjj/TEPcAM7gAcueWP/6S0DRBBvpFNcT PZl0582zdn2aUFThugV0AdW06Pg3YaYAGR1LRvSpgBOzeIWiXOEBMkuvGbQ3mQqFlB86 q3onjnWDSzuvCsNZXiAAkPUYuwVJGGk77+6I503OGt5COBKT7ueu6vcWwcFQkdE+amQt 4Y0A== X-Gm-Message-State: AOJu0YyGg/M80IoaHCONj8WkvGNFwQTaOJbS3B7gXAc9pJWf9NNuW1uA LSQM3/tLWUzoHNEi4ggX1kNrr/HQBrVJmxnRNNlAT0DlN23emS2gjB2C8kQWNNzJur/lXJdvYVt 5 X-Google-Smtp-Source: AGHT+IH827PA3nIJDKFxKNBe3zER4h76Avzr5RQssZWzq7eWMWP7HX22PHkzrBNnUdgF9aBZNSgchw== X-Received: by 2002:a5d:5307:0:b0:368:310d:c383 with SMTP id ffacd0b85a97d-37311841c08mr5132137f8f.5.1724607058320; Sun, 25 Aug 2024 10:30:58 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:c4b4:d418:3b87:bff1? ([2a01:4b00:bf09:5101:c4b4:d418:3b87:bff1]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42ac51622b6sm127279555e9.22.2024.08.25.10.30.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Aug 2024 10:30:57 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------wbt7nPAKhVRi7Q4B3TyjbfHT" Message-ID: <04e02cb9-a2ea-457c-9f81-9d20ddb4d559@scriptfusion.com> Date: Sun, 25 Aug 2024 18:30:56 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Default expression To: internals@lists.php.net References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> <0cfd3a28-3cb0-4478-85fb-cf086d8e5c66@app.fastmail.com> <3e0d031e-256f-47cd-9a2b-dcdc760f5498@scriptfusion.com> <69a5258d-05e4-420e-b4bf-1f58b45e1fc7@rwec.co.uk> Content-Language: en-GB In-Reply-To: <69a5258d-05e4-420e-b4bf-1f58b45e1fc7@rwec.co.uk> From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------wbt7nPAKhVRi7Q4B3TyjbfHT Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 25/08/2024 18:12, Rowan Tommins [IMSoP] wrote: > > For instance, rather than adding "default" to the "expr" rule in the > grammar, and then restricting it at compile-time, maybe we add a new > grammar rule "expr_with_default", usable only in expressions and with > a very limited set of productions. > Like the original commit ? Yeah, we did that. > > Just because it's easy to implement a feature a particular way, > doesn't mean that's necessarily the right way. > With respect, you do not know what you're talking about here. The original approach was to start manually whitelisting each expression grammar I thought made sense. THAT was the easiest way because both myself an Ilija failed in our first attempts to expand the grammar to support default as a general expression, and not for lack of trying. It took a Bison grammar expert to drop a patch that certainly wowed me, because hitherto I wasn't even certain it was possible, mainly because of the conflicts with `match` (but also `switch` to some extent). Aside, with respect to match, there is still an unresolved case and the RFC needs updating with the semantics we want to enforce there. So we pursued default as an expression not because it was easy, but despite the fact that it was hard, because it was precisely what we wanted to do. I apologise for coming on strong, but I put a lot of effort into this, so I take exception to the implication that anyone involved took the easy way out to arrive at this (our best) solution. Kind regards, Bilge --------------wbt7nPAKhVRi7Q4B3TyjbfHT Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 25/08/2024 18:12, Rowan Tommins [IMSoP] wrote:

For instance, rather than adding "default" to the "expr" rule in the grammar, and then restricting it at compile-time, maybe we add a new grammar rule "expr_with_default", usable only in expressions and with a very limited set of productions.

Like the original commit? Yeah, we did that.

Just because it's easy to implement a feature a particular way, doesn't mean that's necessarily the right way.

With respect, you do not know what you're talking about here. The original approach was to start manually whitelisting each expression grammar I thought made sense. THAT was the easiest way because both myself an Ilija failed in our first attempts to expand the grammar to support default as a general expression, and not for lack of trying. It took a Bison grammar expert to drop a patch that certainly wowed me, because hitherto I wasn't even certain it was possible, mainly because of the conflicts with `match` (but also `switch` to some extent). Aside, with respect to match, there is still an unresolved case and the RFC needs updating with the semantics we want to enforce there. So we pursued default as an expression not because it was easy, but despite the fact that it was hard, because it was precisely what we wanted to do.

I apologise for coming on strong, but I put a lot of effort into this, so I take exception to the implication that anyone involved took the easy way out to arrive at this (our best) solution.

Kind regards,
Bilge

--------------wbt7nPAKhVRi7Q4B3TyjbfHT--