[m-rev.] for review: add int32.clamp/3

Peter Wang novalazy at gmail.com
Wed Mar 4 16:31:37 AEDT 2026


On Wed, 04 Mar 2026 16:02:50 +1100 Julien Fischer <jfischer at opturion.com> wrote:
> On Wed, 4 Mar 2026 at 15:47, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> >
> > On Wed, 4 Mar 2026 12:13:37 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> > > For review by anyone.
> >
> > Sorry for the late review, but I didn't have a chance until now.
> >
> > > Add int32.clamp/3.
> >
> > I would prefer for this function to have a more expressive name;
> > clamp_into_range, perhaps.
> 
> I'm not overly fussed. clamp is the usual name for this operation in
> programming languages that provide it, so I went with that.
> Peter, do you have a preference?
> 

clamp is the usual name. I would go with that.

I have used the name clamp_to_range before, in an attempt to avoid the
argument order confusion. My thought was that clamp_to_range(Val, Min, Max)
could be read as "clamp this value to this range".

Peter


More information about the reviews mailing list