Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123032 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 462AE1A009C for ; Mon, 8 Apr 2024 08:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712563576; bh=RjFH/guIHPZVLQMsS1zP81sAK/MEy3hhF97EkWwnUvI=; h=Date:From:To:Subject:In-Reply-To:References:From; b=JmgO2X1r01twubTsVhvV/3QtfzrCJaTzVDLiY2J1blFAhFqhzfUKRYUjJO8rVwZO0 8q2LdC8iutMiYLq7VG+3Xa4ho2Ba7f+1J9eUDt9d/8vFAZe/9ehaXHv6W8ByfuTn6b B+VbxfbY5b6TwCS9O+oYGGkSFcsC4jIItuqrTqN+T0s6y1MtoZSjwhlrP2k7WXV+PA ZOjvsx5OWZ+erbeZmVVTY+wX3kqDLbv2AyCXLD3Sj+eBC8Kjor14H/78CaVI8fJbck eajZTqCgNEXUcAyX5zwWt1foprJSloJuWHFHz/x0l+s5WaHLgp5vvlGglzb1Y/GVYr Wju+6yy49+t8Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B960180080 for ; Mon, 8 Apr 2024 08:06:15 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from wfout8-smtp.messagingengine.com (wfout8-smtp.messagingengine.com [64.147.123.151]) (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, 8 Apr 2024 08:06:14 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id D89AE1C000BD for ; Mon, 8 Apr 2024 04:05:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 08 Apr 2024 04:05:41 -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=fm2; t=1712563540; x=1712649940; bh=RjFH/guIHPZVLQMsS1zP81sAK/MEy3hhF97EkWwnUvI=; b= EtBHFpEyhBXOoGUzf6179LwiLOU3E7wWrxcEVYfneb5ss9tnJBWSBkmCz5aEmER2 sJi68hvz7EtSeiL9Dy5Y9sOn/r+NJMIEFnZIY6vOXDJ50alutQJYLtORrXbvPtCd G2tI4UhVI9vcSOjn8aL3Gc437Hg/b0b/xLUkZI0Vmqc2dJXkr8Fwg47L76jolERD /AgtI5yQE9r1eU07SQKvxpXOO7rAZIfmeXauNBAN3Ne/tSs3CD5Ga4Vn1qRlV4Ja DpqmStO5u9npbNuNuJZf2QUy3CYg0yVHmBYRyfgLfCO8brFovik0x9JvHv9F08A3 T46Dl5D+KLRFHngjmejPzg== 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=fm2; t=1712563540; x= 1712649940; bh=RjFH/guIHPZVLQMsS1zP81sAK/MEy3hhF97EkWwnUvI=; b=G sQZDyYqA0Ew70f7S0Be1jDIMekXaRwKm4mRxYpJqc84Beq7vKrjS5+7G0mldLzGU 8Jh2QL8ThWRByYhwD+jTDUCLXHdLd9PvuIwom2Zx7nED3YM5wBnCZV1oLUcaGc57 1WFsoF9LoPnj9kOWQ/F2bA9DfE2fUxoNcuo9wS2dsJLa3jUqZMMB1b6mXjUAHyMr 8/99zkibDrnocbQeff8PmypyPMxXFZS+/Xv23h7FT9Z2r9X61ELOdE3pDwk527Sj tA8VPpbNODIRXuOQa2D0yhsfDgaQtBitkGvF7VxTYONoenE2enPW54KIoeFBRa+v TjtZw5dwFytyfIczPRPhA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudegiecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepfffhvffufggjfhfkgggtgfesthhqmhdttd erjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehi mhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepheelff etiefgveduteefudegtdduveeludegueegleehiefhhefgtdekveevgfelnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhph esrhifvggtrdgtohdruhhk X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 8 Apr 2024 04:05:39 -0400 (EDT) Date: Mon, 08 Apr 2024 09:05:37 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type User-Agent: K-9 Mail for Android In-Reply-To: References: <3c74f433-be6b-4f20-beb0-f09db2fb39b6@rwec.co.uk> <494F7C68-81FC-49DE-A292-A782F7C79DB1@sakiot.com> <002f0cdd-55fe-48b6-87c3-fcc4dd4c9ecd@rwec.co.uk> Message-ID: <1DF4290C-EE0F-49A4-B09F-56DB18327F3A@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net 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 8 April 2024 01:34:45 BST, Saki Takamachi wrote: > > I'm making these opinions from an API design perspective=2E How the data= is held internally is irrelevant=2E zval has a lot of data other than valu= es=2E What I want to say is that if multiple types of parameters are requir= ed for initialization, they may only serve as a substitute for object for t= he user=2E Again, that only seems related to objects because that's what you're used = to in PHP, and even then you're overlooking an obvious exception: array(1, = 2) If we ever do want to make decimals a native type, we would need some way = to initialise a decimal value, since 1=2E2 will initialise a float=2E One o= f the most obvious options is a function-like syntax, decimal(1=2E2)=2E If = we do want numbers to carry extra information in each value, it will be no = problem at all to support that=2E On the other side, just because something's easy doesn't mean it's the rig= ht solution=2E We could make an object which contained a number and an oper= ation, and write this:=20 $a =3D new NumberOp(42, 'add'); $b =3D $a->exec(15); $c =3D $b->withOperation('mul'); $d =3D $c->exec(2); I'm sure you'd agree that would be a bad design=2E So, again, I urge you to forget about it being easy to stick an extra prop= erty on an object, and think in the abstract: does it make sense to say "th= is number has a preferred rounding mode", rather than "this operation has a= preferred rounding mode"=2E Regards, Rowan Tommins [IMSoP]