Bill Allombert on Mon, 14 Oct 2013 17:05:52 +0200


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

Re: Branch bill-mt for parallel pari updated


On Sun, Oct 13, 2013 at 02:28:25PM +0200, Bill Allombert wrote:
> Dear PARI developers,
> 
> An new declaration is available:
> inline(var)
> This declares that var should be inlined in each functions, with the value
> of var at the time the function is created.
> This allows to create functions that are not stored in global variables,
> which is necessar for parallel code.

I want to clarify that I see inline() as a work-around for a syntactic 
limitation in the GP language.

The recommended syntax for declaring functions in PARI/GP has been for some time:
fun(arg1,arg2)=
{
  BODY
}
However this syntax is not nestable, since {} is not nestable.
A way to write nestable function is

  (fun(arg1,arg2)=
    BODY)

or for local functions:
  my(fun(arg1,arg2)=
    BODY);

and this requires everything to be put in a single {} block:
{
  my(helper(arg1,arg2)=
    BODY);
  (fun1(arg1,arg2)=
     BODY1);
  (fun2(arg1,arg2)=
     BODY2)
}
which is neither usual nor attractive, but which remove the need
for inline entirely.

So maybe we should come with an improved syntax for defining functions.

Cheers,
Bill.