Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128530 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 B2B891A00BC for ; Fri, 22 Aug 2025 16:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1755878734; bh=UJylyVQAuOhtZFXOfUd8ZLYy8DFddwR40zm+3BliqjY=; h=Date:From:To:In-Reply-To:References:Subject:From; b=E36pJiziWOarfbyQcGG/EVbadK61y68wSEerycoXaeSSwXdxQxSCyo+atCXHs/Clj U9DHWcDyHwHvBEWNGmxBGopQK6W4irc1BUNRYsmcWffzawyC2JhCa0yQBd8aDWItnU s9d8ySQj8Oz7EC9uP9f4gPdnVCEbsKeqPRNXxf4ehGdRM3S1LscqPmokZRao4n2uwG 4rM4ISFlDTi6CK4fpqvEpWiPwPFXTBl7UkJxf3nuXbPSfXf4ELl6+6sAbOl6dJdFDI cspigKkS4F8/SwLu8F7dzOGLjs+u0eSVCUxdxsDj2hBUxV2RyW+THpcv4ITrD221NY jpEIlXLK1ujmw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6BFC018005D for ; Fri, 22 Aug 2025 16:05:33 +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-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (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 ; Fri, 22 Aug 2025 16:05:33 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9C78E14006C5 for ; Fri, 22 Aug 2025 12:07:06 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Fri, 22 Aug 2025 12:07:06 -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=fm3; t=1755878826; x=1755965226; bh=6stYKrmzs5TC25DUO6Jlv yS0gZu8dmQ38fCcNqj6/gQ=; b=aYNSp2SNuP5sMvk5tdPpI93+/AnlWFgLHavG/ tbMoJx79y1mTpWPMLq6hGy/aYNIdL7CUZtB4NMZf1Sz+DyMaCQS4jCngUkyYAAl6 6iLdYCz9lG5tA0hwR/uGvwkhG+d4IKST+YrAfJ6M0H0p23J+Cme0wOIVmOVAOb7u hE2BF6vn6DReu1y0iQ8PEY9hMf/4eao6SeesIOcqSnoWPnTqMJhHNxkMKqckuU9c ValC33irk72+lU1BM6mTWTJ49L1jtK3Uc7IRM/PWNlO3LFlPizPQpPqDYoVaZSn9 4T6BjeiHHj9crg8a5zKO6UL6pi4+CbICRWmMgt20eNi076RfQ== 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=fm3; t=1755878826; x=1755965226; bh=6 stYKrmzs5TC25DUO6JlvyS0gZu8dmQ38fCcNqj6/gQ=; b=IuX2I57Krlz7AHSg2 xVX/2rv9LaZcb0VrNXltkkoUHeKnPz1HsrAYaiIsaxAwojzBbmL0mlLjmm+EZ8Ln PR9/tIT1pjftfeQ639AlwyXD+jZ0nOk9itHbCOlJwnC7nPXgPZuDt4YqNU1k0L9q ZjHuUQqHl8aXG7KWg0AjQeAye/TKV2JRZQj27Qjcd3TxAUohVEkwPzzvZL1Pf2oX XkEHotpUm9mcPs67PdnAitWRl1UtK791OiOI8eM082LfN1v94gjGG4yHP6g4BlDl BOzoJMvT6FxHEnmaFtJD/4H5eheRykuajZImPDtdPgp57z6mOU1yhYjhFOWzQPUz niM+w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduieegudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 31F52700068; Fri, 22 Aug 2025 12:07:06 -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: AEQpMGw9UeFk Date: Fri, 22 Aug 2025 11:06:45 -0500 To: "php internals" Message-ID: <272c241b-3145-4069-8a6a-9ea877f936c0@app.fastmail.com> In-Reply-To: References: <0027ab13-89fb-40b4-991b-2f88a35c2f31@gmx.de> Subject: Re: [PHP-DEV] [RFC] Add clamp function Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Fri, Aug 22, 2025, at 3:01 AM, Kyle Katarn wrote: > 2025-08-20 at 14:28, Christoph M. Becker wrote : >> On 20.08.2025 at 09:29, Kyle Katarn wrote: >>=20 >> > 2025-08-19 14:59, Tim D=C3=BCsterhus wrote :>>> >> https://wiki.php.net/rfc/howto#external_resources#rfcs_belong_to_a_si= ngle_author >> >> (the "RFCs 'belong' to a single author") section. The existing RFC= may >> >> only be adjusted with the original author=E2=80=99s consent. It mi= ght be easiest >> >> for you to create a =E2=80=9Cclamp function v2=E2=80=9D RFC instea= d. >> >=20 >> > Thanks, when I go to https://wiki.php.net/RFC/clamp-v2 and click "E= dit the >> > page", it says: >> > "Sorry, you don't have enough rights to continue." >> >=20 >> > Can you grant me this permission? Thanks. >>=20 >> I've granted RFC karma to the kylekatarnls account; there is also a >> kylek account, though? Can that be removed? >>=20 >> Christoph > > Thanks, yes "kylek" account can be removed. > > I created https://wiki.php.net/rfc/clamp_v2 (re-using most of the info=20 > from https://wiki.php.net/rfc/clamp). > > Thanks for you The grammar in this one sentence is very clumsy: > clamp takes three arguments, a $num, $min and $max, checks if $num is = within the bounds of $min and $max, if in range, returns the value of $n= um, otherwise, returns the nearest bound value, i.e. if $num > $max retu= rn $max, if $num < $min return $min.=20 Please break it up into multiple sentences so it's easier to follow. I = think I follow it, but it's clunky enough that I am not certain of it. := -) Also, the text says $num but the code example says $value. What determines comparability? What happens if you try to clamp values = that are not comparable? Eg: clamp(new Point(1, 2), new Point(0, 0), new Point(5, 5)); I assume that will fail somehow, but the failure should be described exp= licitly. --Larry Garfield