Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128574 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 68E531A00BC for ; Wed, 27 Aug 2025 16:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756312783; bh=RtUy4ZIRCRWSvx2E1w3qys+JgHh8aOImRWUJGw4Y+gY=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Yk3RVIzLDEdazyy6X71NkdEgqV4aixUPe5sRdHahz3RWvVKj4U0AS+y/gsSNwHbWm NeHa89ggEb4Sxo1I81eVFgG730iRCvuApO+PISCZbgE3zWwmaPWstYnyYTI4/X9wrd rvi4w5KTiMMywlxvmyRHCSqMSNt7S9j48N7Y8WjO+EVNpAY2eoeEjHTWPrf0SKZq5G /+WxekMTkc18UokPK7ZC0GU6EBkvaEYFgEk3gc/080UjdR6oJT7KsDXttfRgXXVqNX 7JGwto9I7QeDBUdvpHechq3rq3qS1QgmHFAzVFYJsOTMQw2cyrOMLagRXHGtHstT8Z LVBEUTqtr1lyw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C983180059 for ; Wed, 27 Aug 2025 16:39:41 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 ; Wed, 27 Aug 2025 16:39:41 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9222C7A0034 for ; Wed, 27 Aug 2025 12:41:12 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Wed, 27 Aug 2025 12:41:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; 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=1756312872; x=1756399272; bh=3kmEQE+EXRUI69vB0hP0q W6bcN2snIny8ec+qLIfVG4=; b=Lv3FoktEG9diaqGShQtQIOiyN1EQBAOkPHaux /kafOcsiW43poggcks1xXqeb12VIvgCTBiY49g1gQ7YRcHEn6Z5yetttVxAUp5fP pIf187bmqDDwqTZ6fppybGA+4YiHtxSPisKdcwJVlVKsIyeewUrh2rhtRThyzFi9 m0yEB/Iq4TqfhHdOaoyTr1IReDJXe/O2QnjEVmBelIWHJL7+gAg/cqoARlACiuY/ AkZ/zl8NlqH/PWESLM/bbU0+BU+eGFTlQBMkWlYCAn/jIzV+t6wFy/jN8oRI9A+G e7QPTCMsAl5jB3KRJ7pyfeEgi37zCPFY0exb64eaqWXUsIROw== 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-sender :x-me-sender:x-sasl-enc; s=fm1; t=1756312872; x=1756399272; bh=3 kmEQE+EXRUI69vB0hP0qW6bcN2snIny8ec+qLIfVG4=; b=TLK8b25XuaEyI355G RaxCyZ16gkhPZIkNUHnPdmiISfzeDdMy2t1EHlAv/kPiZDy6jRW6IntNrU9tkBL8 26VJmV9y7xopWbNa0QNmD4xSgLtaxsAfhWExMhZcw8/DUOKw9aeubU+NXyq3oUBM 6h8cSCj35ujfcD6jxvL7CHDtDQIKdh/Z89gdwqfkKge+S6aCz5Ct42zGY/vKHEjX QykDIWfCU/8oZ4bLJFRTUYm/xc89fQgBKD8ghKSClnLtob4bEdiSlUfMxamDugw/ 9tT3FBahn96OE9u7zo2H7OD5u0FO0abWxf4JZCTL4hXVhbp/O33B89yUAJClG3hj o0b+Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeekieeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeevvdffudfhteeugfduvddvtedtueejledtjeelgfejledt heevuefgtedujeevleenucffohhmrghinhepphhhphdrnhgvthdpghhithhhuhgsrdgtoh hmpdhmohiiihhllhgrrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsg gprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghr nhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0C43A70006B; Wed, 27 Aug 2025 12:41:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AAi9W-atQONs Date: Wed, 27 Aug 2025 11:40:51 -0500 To: "php internals" Message-ID: <090b74db-6e29-489e-870e-4c1e336c7746@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add clamp function Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Wed, Aug 27, 2025, at 11:06 AM, Bob Weinand wrote: > Hey, > > On 27.8.2025 15:34:53, Kyle Katarn wrote: >> Hello, >> >> I handled the feedback received on the draft RCF https://wiki.php.net/rfc/clamp_v2 >> >> If I didn't forget anything this should be now ready for discussion. So I updated its status. >> >> There is an implementation proposal: https://github.com/php/php-src/pull/19434 >> And some draft for documentation here: https://github.com/php/doc-en/pull/4814 >> >> Thanks, > > > As others have noted before, what's the motivation of having the > to-be-clamped value as first parameter rather than infixed between min > and max? > > E.g. from CSS: https://developer.mozilla.org/en-US/docs/Web/CSS/clamp: > > `clamp(min, val, max)` > > Feels to me as the most natural order, too. > > > > You mention it was taken from the first RFC, but that one also did not > discuss the ordering in the first place either. Some quick data points from momentary googling: CSS: clamp(min, val, max) Python: clamp(val, min, max) C++: clamp(val, min, max) Java: clamp(val, in, max) Javascript: clamp(val, min, max) C#: clamp(val, min, max) Kotlin: val.clamp(min, max) (as an extension function) Ruby: val.clamp(min, max) So it looks like CSS is the oddball here. We should follow the clear majority approach. (Kyle, feel free to include this in the RFC.) --Larry Garfield