Loïc Grenié on Tue, 10 Nov 2015 12:31:59 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Vector of args


On 2015-11-10 at 9:14 GMT+01:00 Kevin Ryde wrote:
Bill Allombert writes:
>
> If f is variadic,  the variadic arguments must grouped in a vector in the
> last component of A.

I'm trying to gently persuade Bill not to do this bit.  What does
anyone else think?

I would like to call(f,[1,2,3]) for either f plain function or variadic.
I think in general-purpose code you often won't know which some f might
be, and even if you do then you'd prefer not to know for the sake of
uniformity, protection against future change to f, etc.  Otherwise if
code wants to allow both f then if I'm not mistaken it would have to
resort to maybe if(isvariadic(f),call(f,[v]),call(f,v)).

      I think I agree with Kevin. It would create a discrepancy between
  command-line and call(). If f has 3 arguments then I must call it
  with f(1,2,3) in the command-line and call(f,[1,2,3]) in a function. If I
  upgrade later f to a variadic function, the command-line remain the
  same: f(1,2,3) but I must change the call to call(f,[1,2,[3]]).

     If there are no technical problems, I think it makes more sense to
  treat variadic arguments the same way as fixed arguments.

         Loïc