Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125304 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 3903C1A00BD for ; Tue, 27 Aug 2024 06:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724741400; bh=u92b2i1S9PoPnPLJ+zV5CwqR8EGLrLFqAejP9egU6PU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=KlzYkPh7v6joe2IOnnS9GAlszygQ8vVAsml1zY7lANy5tz8lMA0wfnMcawSH5t0pE lp7BFqRtxSI4ueZwq6XCPdVFWPY55J49NqvqD2iScvBmdgecMrcmtlPFdlB7RppuZY hD/XxzmfgjpGkctJ2pSTCLmO6xVWJo/14w0u4oaThHLWN+O8Dw7xnbRhvHRR+9zYwp RqRp1a3wl28m0I5RGF2M7UKqsrrld77eybK79GRymo0vt8tfIZ3VaYA1EEIvd7I+ty Obr7I+CTxmOoyFkTUSQ0A8CGYhMF5rT/lzdDVX15PV/peOFx9UOEQsEImVN8s7Blai lYpFMl8+X8ACA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 009E5180051 for ; Tue, 27 Aug 2024 06:49:59 +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, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout1-smtp.messagingengine.com (fout1-smtp.messagingengine.com [103.168.172.144]) (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 ; Tue, 27 Aug 2024 06:49:58 +0000 (UTC) Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfout.nyi.internal (Postfix) with ESMTP id D85F2138FF1C for ; Tue, 27 Aug 2024 02:48:04 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Tue, 27 Aug 2024 02:48:04 -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=1724741284; x=1724827684; bh=KM/bps+gMojnx4lsWAJVxkHdsHcDPXGx+yQFMOs1N/k=; b= pojhnE6b8kejht3n0nNVjZnIz5H+gSj97yoFycEqjJcZTw1CNUm5KgPCZNmeY1gU KrnUGc+qBOrLAX6D+Eg2ugSUQ+ktk+lhMd0ERdIJpmJfurBkLF0YfmIHEdnfDdoT y/VfIU5gX1ucPnHuloS3XrFEWod2LGlYZ6J0w2VihnhMvH3V45skZryzCwzG13tw eDlK20zIpvoxK8rRjWctVv4ca9ERmv63R76Yn+8ETzFyhR17RBmEVW5ToY1wxSd4 2U/STNRhQt6Nx3b4rGiwREldXvy4nvI7NgkodwrBCZ7NlvbYEV6ZbPBGSHWGIAGh dY1DNPFhZjyOAzFfxCHt+w== 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=1724741284; x= 1724827684; bh=KM/bps+gMojnx4lsWAJVxkHdsHcDPXGx+yQFMOs1N/k=; b=a WUCxAyfPxwa75owCWPDyLKVEPyjt/GwT/wF7H+hAEgOgP21RT0AHi+fEPtYFgukt ZbhtQJgPndHpZeHUzYk5z6MyRhrpyhH5t+MHCXcUwqdQ/OZ0jx41S2dZwe0w4Hy5 B2Sk1PBRbQvS6D7ET5WlgQ1HYG1LXP9PP61YioHjTb6JQk6VyJM2QFs5j/bA+3b9 nGxRp+6o5tZYfqb+EB1kXTPMeFDLtYsbodmThCU/3flKcDYjt1qQj97sqQHRPEjw ZlD6v5vGzbZ56RpTe3FCd+q/YrWBOCKSHJbt8+jCZMb1hFRlSdJ5ma1gNGgTUCX9 DH+80i7azZS9do4EwhYJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvledgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvf fufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepheelffetiefgveduteefudegtdduveeludegueegleehiefh hefgtdekveevgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthho pedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlih hsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 27 Aug 2024 02:48:04 -0400 (EDT) Date: Tue, 27 Aug 2024 07:48:01 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Default expression User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 27 August 2024 05:20:32 BST, John Coggeshall wr= ote: >> I DO think there are likely whole categories of expressions we can like= ly say "no" to - anything where the default represents a union type (and _m= ixed_ is a union type) should likely only allow default by itself or as a b= are value on the RHS of an expression=2E I don't think having additional restrictions on union types makes much dif= ference, because even if a signature doesn't use union types now, it can be= extended to do so at any time, either in terms of inheritance or evolution= in a new version=2E It is a well understood principle that widening the type of an input canno= t break existing uses, and relying on the concrete type of the default will= remove that guarantee=2E While the example of bitwise or in the RFC looks appealing, I am no longer= sure I can even support that, because it has the same problem - in a futur= e version of PHP, json_encode might change to take int|JsonOptions, with a= default value that is an object not an int=2E Code passing an integer won'= t break, code accepting the default won't break, but code using "default | = JSON_PRETTY_PRINT" will immediately get a TypeError=2E With the feature in = place, such an evolution, which was previously safe, would become a hard BC= break=2E Forbidding that evolution, not just to that example, but to every function= or method with any default parameter, is too high a price to pay for the b= enefit we'd get=2E Regards, Rowan Tommins [IMSoP]