Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128586 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 lists.php.net (Postfix) with ESMTPS id 8CE111A00BC for ; Thu, 28 Aug 2025 16:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756400008; bh=xbSHDTvDGi+QmdE5zX3Lq1Zt6bPOeybBhs2kTlVElSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsWERzFCuwaSsihNpcRGZX7E5f759f0A4juHN2E3rjeCJfJ+u4AsKT8K175FB48PD aXPXOF06jc19J9dOjQQpVkh0zfPXX7YbRdN6K+OabZWxOPNnQnTedMK0pi6C9KWRQM LSgglQG7qp1lcRxTAkHIpnEsZTa43KTCP99spoj2a+jQp++f8ksKklJf97Zl/HskfR qXx/au67k99sKgLABOLOUBUkJd65NGwjYL6SPP5IRoieBT0c34nDwrXfAyGrTmkVCU 5+/hJP4LVDPbUgNeLS84yi3Z9yb1+aSPksropPqwfLMgZ8Qv0wttEHmJOzH0Vnt1EK joA6ymf76oolg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 43C211801E6 for ; Thu, 28 Aug 2025 16:53:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from sonic306-20.consmr.mail.ir2.yahoo.com (sonic306-20.consmr.mail.ir2.yahoo.com [77.238.176.206]) (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 ; Thu, 28 Aug 2025 16:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1756400096; bh=xbSHDTvDGi+QmdE5zX3Lq1Zt6bPOeybBhs2kTlVElSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=sHEzX2ZakSEHfXBuq7t0OoX3LnoJls7znLSHDiNmD1YHTPf2M24fFCivcywD8N6ryAtgXjJHDq7ULHsss3JxS0RY0Ju6726LakPiaxQgC6eMe8VL/7oasO7FXcpa8tvoOuZSnX0ILJc9VpxLI8665dkveEbpY+HN1twV9bkF5JvTnritELWCf5jM6TikW3dROPb1yA/8W4iEmkWfcL1+7S2ev2br6EUgo+2LpqMfh+SbatpnA9vkrgFmYkMvfBu62+FUCB8/LwWLsp4U+bESP6g8/JT04SnS2Hc+RPS/GAL+i9UG68dstdPrKjNO3DmM/B1MOAfqOWBx39vHGABQsg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1756400096; bh=KyUvDoZhfZUbCemHnmEsqA12/WRo6vEDA+1O+60Jqdj=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=J/hSnrqCAq2IuhSK79PWOuT5f5teRwx5SmN50JS81L3Hx9N+/k02u3Y/8hT0bfBqLzg40eYMCMNpqPdpLI13FwDW4AAjDGV9sZfKmR9g7izTkw0XfH5ItKLxnEcBNHH0722CVfZ6Zvh2Mf8rvjEv2JW/fPyzZH8cX3Zx3y8RAYiT8FMjdV2DYifKI5WXfz19soSvRz5Sc2BGuadMg5YgKU3Kcx3F9/vKyWahr2ivY8hcztbsm6QFH4+04WweQvUrYEC/94iT9IxcufB9bdYXCXC8PFhv7XKtuBkPimCF0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27Meg9CRxpGlrLOBj9EZvXZI_Ic8pltUNMdNKnqS.e6RZavDaSC64Hd aaAbxtPMegwWu3mdO9JOGzVwOALLYbzP38Ygk7L_GBHdR6ROIc28ECeh7Ux4AnGe_Nt8mUBG1u_B qgxLKucByd4S.9_ahJxxqXhSmy.LnF0UAubynIsKtLUQ6R_Ea06LHNnPckKo0BXYmRiDKCh0EIir RM_o8gpmNjB3ZLK3UzHROMzyB6LOZHph4OXmP_9pBQQrK5Og11V_4GzkqSV_fnS9kAoweDg-- X-Sonic-MF: X-Sonic-ID: 7757a780-1a4d-4be3-a36f-24d31352845a Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Thu, 28 Aug 2025 16:54:56 +0000 Received: by hermes--production-ir2-7d8c9489f-qnbs9 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 52bef625802caf8285379d1328043176; Thu, 28 Aug 2025 16:54:55 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Message-ID: <1756399368311.4054485786.1195379738@yahoo.de> To: tim@bastelstu.be, Morgan Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] [Discussion] Add clamp function Date: Thu, 28 Aug 2025 16:54:54 +0000 In-Reply-To: References: X-Mailer: Vivaldi Mail User-Agent: Vivaldi Mail/7.5.3735.64 Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 From: hanskrentel@yahoo.de (Hans Krentel) On Thursday 28 August 2025 13:28:43 (+02:00), Tim D=C3=BCsterhus wrote: > Hi >=20 > >> There's precedent in ext/random with the Randomizer::getFloat() method= that takes a Random\IntervalBoundary enum to decide on the the = interpretation of the boundary values. Translated to `clamp()` this could = mean: > >> > If it weren't living in the Random extension, that very Enum could = have been used. >=20 > Indeed. Back when introducing the enum, we actually had a discussion = about naming and =E2=80=9Cplacement=E2=80=9D. In the end, we opted to make = it ext/random-specific as a more conservative choice. I think back then it = was the first native enum. >=20 > See https://externals.io/message/118810#118910 and https://chat.= stackoverflow.com/transcript/11?m=3D55444127#55444127. >=20 > If a new general-purpose IntervalBoundary enum is introduced, I'm happy = to widen the type in ext/random from `\Random\IntervalBoundary` to = `\IntervalBoundary|\Random\IntervalBoundary` (and deprecate the latter in = one of the following versions). >=20 > Best regards > Tim D=C3=BCsterhus >=20 Not sure if I'm too much off track here: As we can't alias classes in = userland that are internal classes, internally PHP could do the oppsite and= given clamp could borrow it out to/from \Random\IntervalBoundary given we = have enough discipline. That also could buy some time on the widening idea = and preserve a bit of the conservative approach to further on defer the = details until necessary. Widening is certainly correct in its own right, but why not keep the door = open this way so one day we can applaud the first internal enum for its = foresight? -- hakre