Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128582 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 2A30F1A00BC for ; Thu, 28 Aug 2025 11:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756380435; bh=maJhmJhnGkwrmHLOLNuA9rdDfOvOAmwe+SLXZPlkwjc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fNhxy3YDBDW9CAKWCzO6Bdq4zcVDpw5z3oMK6FD//mq29rpP9EAQUhTWtMF92u5Ch VyecbFPlfJA1FuXx6pLI1+E8o6pIezrjxr9dKnJi0CCVhpl/g0fbxmII12r/N7wIEX 9PUcHcGG5dYasMbSzYMIx10wAV7lnqxapaXUosgmQmfc7J8380ErJd3qRgbqPfKbSX w2Y5TrGsGzgqQYrluS0y0n85qyuvmC3Pvd9aYiqCaDMvJ2XcyM/Be/eLyDDAtl597+ Ab6vtD+5p/yy6nsMiBfNYtmTeN82aXRaOaJLZuj+VNrXqFzw1e4SBgNdvDlWA68Du+ GzOg+GZ0IxSHA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4BF5618006A for ; Thu, 28 Aug 2025 11:27:14 +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_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 11:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1756380523; bh=hUphf2guuofIu6h5kH8BEScEe/fIEBfT2oGLd/tnHbE=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=fq5BsiUG0OryIz+u57kZQcmkHjkwh3pqr2r4GMCOTl1U2Quw/5VI9+TIrnVh3Tumn 4BuQk1uIFKkvK6qVbMsXOREZch8ba3Q0iHrpav6w67NW7aVd/gUbLnAYhg5a51pnDN k/nO5lcKsJMpA/nyVPb8BwvTYNeQsrdxPTx+21tCjLpsp8GnOtv3f3GyoF7lHwnenW 6DDp4IXQM2eOD7jnMPqe0eIFi1GZqPJJcAQNtT78SeDzX+z6awB4Bdn/Zx4tQhYFjO jE9G955k5y8KXSpNb6LAvBXkPTKRKWA6phJzssO44hr8JQX+Zb4BBDes/D5wFClbk3 qvozJjFwqV29Q== Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 28 Aug 2025 13:28:43 +0200 To: Morgan Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] [Discussion] Add clamp function In-Reply-To: <32e94a0f-2e2b-48f3-90a0-ad0096608809@varteg.nz> References: <1756361767126.3727989781.4204927711@yahoo.de> <3b1bd29cd42074b499d38e10cb97bf42@bastelstu.be> <32e94a0f-2e2b-48f3-90a0-ad0096608809@varteg.nz> Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi >> 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. Indeed. Back when introducing the enum, we actually had a discussion about naming and “placement”. 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. See https://externals.io/message/118810#118910 and https://chat.stackoverflow.com/transcript/11?m=55444127#55444127. 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). Best regards Tim Düsterhus