Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125265 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 175811ADB60 for ; Mon, 26 Aug 2024 10:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724669166; bh=20dQzQMEl/8LEUZXzkF4A57auaHV8mCx4WeHU5SmxSc=; h=Date:From:To:In-Reply-To:References:Subject:From; b=XsJC1mrJINJBtnk7BtN+XNi+R3gfG52vOglQ3yLOULKnxOX2bygJD4O+uPUGtzn9o rl3gtMWAV9LJa3XaSssMHXydllMtXJYhgUOXf2IGDDNyVPVVRCUSxJxKM7HdgtjdFs UitO/C1VRKc5V163Q4a3B3UNQekZDj53zeM/lVNw/0dG+uc7JIKGvpo79XqPc41tJg F2APRE7m+eID7hNwkewzQwIkV7ItvPAQB/KEVihhhjKAa4X0fA/cres0hTpU1kLhp7 Tbosp84HIiRz2G8kclM4UqbBv2JhPWtFms86JzRvieKtEaztH+xto3a94JIfhMlQvV 5g0FA5/4V9YcQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C4A11801E3 for ; Mon, 26 Aug 2024 10:46:03 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (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 ; Mon, 26 Aug 2024 10:46:01 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 2A580139076B for ; Mon, 26 Aug 2024 06:44:08 -0400 (EDT) Received: from phl-imap-10 ([10.202.2.85]) by phl-compute-03.internal (MEProxy); Mon, 26 Aug 2024 06:44:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1724669048; x=1724755448; bh=cL8c3lYyGsrDxRu11lGYaeQUqaihwlx+Pp8qy1KXUyA=; b= aulIqbVPW3cI4E3ZsLiEn6Tj6Ow1f5+mhokjS6I6IbFA+ve88oRTYvwcwJSC3ZbL TsICo/qxSwjOe0UucaVtc46oM1Q7EgWj+Um0dKl1uGmXgnRXd2LLMbO889qM9EtW 5Na7Ss/Ko61l5e3clhVCEVI37w+5RGuHqseI59Y9FQnGP3+POPrgxgtKVn6vVGVe 4V8RwvlZvR2isa+a3MHVx5LqY2N2fxOUv75k15y7UJeOTT6Ns3JC23i4G7eEo1Qo gvn1vaVsmUzFTGD42q9C5SOp5zLEqN9Fc+FqXsiySyJU3y2tBg1UAjPLfqiBRakg BcEepKtpb8zCg6cHuL9MFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1724669048; x= 1724755448; bh=cL8c3lYyGsrDxRu11lGYaeQUqaihwlx+Pp8qy1KXUyA=; b=O tKE0lixPpi1pTxrw43fJeP1d2UiuclSi2k2JQ0s0o9W4OdDPDkIfbOZXfQycvdEx Tfa5TweqjLytSuUHR8iLzfiJMf+Y1cCsj+XK4DoQf0A5uipr2RZiU0/SPCyFYJ2C gg2lpIg7wlhAgBqACQXOuXxgC2XEYmLbu9G9O4SPzpstPnEo7IymcBQTHwWko9wz RCdLQfhPLmPvyoBfw4DI/WgnkUkPMpZCdoFsW1sVVBS1+0XpjIj5OI0kSI6ztH8/ f2u+EzXRhQLzbjpcSGmStPbzvt1BMAh0iUwcRCRsxpZhL4yB4HXD3IUkqVODiBo8 zju6I0xNBtLyNN78ZoZPA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefoggffhf fvkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhn shculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenuc ggtffrrghtthgvrhhnpeevjefgvdehffeuudelgfeutdehteefhedtffdthfetvedulefg ueeiteelffeuvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohep uddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhish htshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E68FA3C0066; Mon, 26 Aug 2024 06:44:07 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 26 Aug 2024 11:43:47 +0100 To: internals@lists.php.net Message-ID: In-Reply-To: References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> <0cfd3a28-3cb0-4478-85fb-cf086d8e5c66@app.fastmail.com> <3e0d031e-256f-47cd-9a2b-dcdc760f5498@scriptfusion.com> <6afeb23a-867f-457d-9b13-fdf5af02c31e@scriptfusion.com> <928d6c8c-c969-4d55-82ff-5da8fc3d3035@scriptfusion.com> <73301950-03e7-4f3c-9fab-402645f77272@gmx.de> Subject: Re: [PHP-DEV] [RFC] Default expression Content-Type: text/plain Content-Transfer-Encoding: 7bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On Mon, 26 Aug 2024, at 10:14, Bilge wrote: > You're absolutely right, I would be interested to see any viable patch > that effectively implements a set of restrictions on how `default` may > be used. Requesting it be done at the parser level was not meant as a > gotcha, that's just how I (with my lack of experience) would have > approached it, but certainly trapping cases in the compiler is equally, > if not more valid and/or practical. Another approach that occurred to me was in the executor: rather than evaluating to the default value immediately, "default" could resolve to a special value, essentially wrapping the reflection parameter info. Then when the function is actually called, it would be "unboxed" and the actual value fetched, but use in any other context would be a type error. That would allow arbitrarily complex expressions to resolve to "default", but not perform any operations on it - a bit like propagating sqrt(-1) through an engineering formula where you know it will be cancelled out eventually. I don't know if this is practical - I'm not sure how that special value would be represented - but I thought I'd mention it in case it sparks further ideas.