2025-08-22 at 22:29, Morgan <weedpac...@varteg.nz> wrote:

> On 2025-08-23 05:29, Kyle Katarn wrote:
> >
> > Also from my point of view,  min($max, max($min, $value)) has a counter-
> > intuitive reading when used to clamp a value.
>
> Well, that's trivial to deal with:
>
> min(max($min, $value), $max));
>

It's not just about the order of parameters, it's still not intuitive to
call max() with $min and min() with $max, you still have to think about
what it does step by step to make sense out of it, while clamp($value, min:
$min, $max) or clamp(min: $min, value: $value, max: $max) will provide a
syntax that immediately make sense for next reader.

Like the author of the RFC v1 also mentioned, min(max()) is inefficient
(see the inner complexity of those functions).

Reply via email to