When these procedures are implemented with case-lambda (and when case-lambda is more than a mere macro keyword), it is not too hard for an implementation to dispatch on the number of arguments at compile/expansion time, rather than at evaluation time.

--

Marc

Marc Feeley <xxxxxx@iro.umontreal.ca> schrieb am Fr., 30. Dez. 2016 um 19:07 Uhr:

> On Dec 30, 2016, at 1:01 AM, Alex Shinn <xxxxxx@gmail.com> wrote:
>
> Since a primary motivation of this SRFI is performance,
> and variadic procedures are slow in many implementations,
> it may be worth specifying fx- to always take 2 arguments,
> and providing a fxneg (or fx-negate) for the unary case.

I don’t like this argument for fxneg.  There are other Scheme primitives that also need to handle optional parameters (+, -, *, /, atan, min, max, gcd, lcm, string->number, make-string/vector, read-char, write-char, peek-char, read, write, …).  Some of these, particularly + and -, are important to implement efficiently, so I would expect a good implementation of Scheme to handle optional parameters well (either by special casing the code generation, or having a parameter passing mechanism such as #!optional). It would be unfortunate to steer the language/API for poor implementations of Scheme… I wouldn’t want to see atan2, min2, min3, etc. introduced by the same argument.

Moreover having both fxneg and fx- breaks the parallel with -, so the programmer has to remember one more inconsistency.  I guess that could be seen as an argument for introducing plain neg for consistency… :-(

Anyway, just my 2 cents…

Marc

To unsubscribe from this list please goto http://www.simplelists.com/confirm.php?u=WKQ6lCmF78fT4TBTylDWtOOtzZKGJt9u