Loïc Grenié on Wed, 11 Nov 2015 09:18:29 +0100

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

Re: Vector of args

On 2015-11-10 at 23:24 GMT+01:00 Bill wrote:
On Tue, Nov 10, 2015 at 12:31:51PM +0100, Loďc Grenié wrote:
>       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 you change

and then call(f,[1,2,3]) will still work

   but not if I change

If you replace a fixed arg GP function with a variadic GP function, lots of
things will stop working, not just call(). Variadic GP functions were not meant
to write replacement for fixed arg user functions, but to write replacements for
built-in variadic functions, like printf.

     Ok. However the use case is not completely useless: think of writing f with
  a constant c and then decide to upgrade it to arbitrary polynomials with
  coefficients in c[]. If you call(f,...) or, worse, if someone else uses call(f,...)
  the upgrade of f makes the "call" break.
This proposal makes it harder to use call inside a variadic function, which is
an important use case.

      It is obviously important. Is this because you would like to use


  in the variadic version of f (where g itself has the same prototype of f)? In that case
  call(g,concat([a,b],c)) would also work with the version we propose. Inside the
  variadic you know it is variadic, outside you may or may not know.