Feedback on hypot and hypot2
allen at wirfs-brock.com
Wed Aug 15 19:40:46 PDT 2012
On Aug 15, 2012, at 5:09 PM, David Bruant wrote:
> Le 14/08/2012 04:16, Allen Wirfs-Brock a écrit :
>> check out the current ES66 spec. draft. Based upon discussions at the
>> March TC39 meeting hypot2 was eliminated and an optional third
>> argument as added to hypot.
> Quoting relevant part of the March meeting notes :
>> Waldemar, MarkM: Why not one or zero arguments? It would be 0 for
>> zero arguments and abs for one argument.
>> Allen, DaveH: If you pass one argument to hypot, you'll get NaN.
>> Luke: It's not variadic.
>> Waldemar: Why isn't it variadic?
>> Luke: 2 or 3 is the 99% use case.
>> Waldemar: 2 or 3 arguments is the 99% use case for max.
>> Waldemar: If it's not variadic and takes only 2 or 3 arguments,
>> you'll get silent mistakes. If you pass in four arguments, you'll get
>> the hypot of the first three, and the last one will be silently
>> ignored. That's bad.
> I agree and it seems to be unadressed by the decision in the consensus,
> is it?
> If it's decided that hypot should only accept at most 3 arguments, then,
> passing 4 or more args should return NaN (instead of making people hate
> I however still believe having hypot variadic is more interesting, though.
>> Luke: Will go back to the experts to explore implementing variadic hypot.
> Who/what does "the experts" refer to here?
presumably Microsoft' keeps warehouses full of experts
>> Note that the new function names such as hypot are generally selected
>> to match the names from widely used c
>> libraries: https://docs.google.com/spreadsheet/ccc?key=0Ak51JfLL8QLYdDBVcFZaMXhlY2d2RnM0TDVxLWlua3c&hl=en#gid=0
> I certainly missed the discussion where this choice was made, but does
> C-matching matters?
> For Math functions, I would tend to favor function names math folks are
> used to, like the ones in Matlab (which I don't know at all, maybe they
> map the C ones too).
> background) big enough to consider familiarity with C function names a
I believe that the thinking was that people may be translating Math libraries or numeric code currently implemented in C/C++ into JS and that name familiarity would help.
>  https://mail.mozilla.org/pipermail/es-discuss/2012-March/021919.html
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss