Jacques Gélinas on Mon, 25 Dec 2017 01:54:54 +0100


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

RE: Arity transfer from built-in function ?


> different calling convention
Great explanation, thanks.

>The GP compiler generates code to convert between them when possible.
Yes, I noted that "vs=vecsum" does work.


Jacques Gélinas




===============================================================

On Fri, Dec 22, 2017 at 04:27:48PM +0000, Jacques Gélinas wrote:
> What is the t_CLOSURE assignment problem here ?
> 
> # vc=vector;
> # vc(4,k,k)
>   ***   at top-level: vc(4,k,k)
>   ***                 ^---------
>   ***   too many parameters in user-defined function call.

The first k is not a function parameter! So the arity is 2!
When you do 'vector', you are converting a builtin function to a
user function. Unfortunately user functions and builtin functions
have different calling convention. The GP compiler generates code
to convert between them when possible. Unfortunately some calling
conventions are unavailable in GP. This is the case here.

So the only thing that is supported is
vc(n)

Cheers,
Bill.