Bill Allombert on Tue, 11 Mar 2025 16:28:00 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: calling by reference
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Tue, 11 Mar 2025 16:27:57 +0100
- Delivery-date: Tue, 11 Mar 2025 16:28:00 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1741706878; bh=q8YUh6oVHpQS39OgmB7IvnNaE+wPELV+lPjNvegQzgk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=V5KJUzVengNbt+afItG4CayGoorPFTKHQtQv/UR6RECurWNkkaYfgR7lcNvQECyyi 4g2/+9yC0QILnTfGFnG8ajYhBgHL5C0J3dewXZ7qSkZ3swaLO1rda88FoHhl3nc2Yd nOdsm5FHg4HI/+DkwwwLvq8bZm4SQ3ofS7bWPe5ck6y9JG+xPor9JhN7o+eNPmqHY1 128jn7kGkh2iOijSssOVK2LtGnB4OQ1orNRe2mA/sYkuT5L4NQ0qX0yCyKXZBoN43D 8y3Y7E1JfWnJaOn1LdxZokBOX2PGzi96sJiwqITj4lM/8n/eeyk3+i8puCsgybGpxG vfEL/eA6vnBg37WNmd1psKCg5vKrpgFLb6slCcaz7rMQXrOfhJbFKx+0087+01T6xG 9H29u376HL3niDzHLVuqFPfoU0bsrKEA3FB4HW43Luu8NIO71eN6GdM0Eki/O/EVLu MF7YfW73y0gtU2XFDS7UlVH8OG2K+G0HjNrRUORgUI7XV991XHDBy7Hdmvn4rUZC8c t9gPXC4xvGmj5phgd+LQ8ijRPR6QQvkhz2DSxQlnA8BRo0qnu4CuCkHulMBKFykEXD TOPsn8kq+InvLR3QS+a1vVZMX54Za2wJx+Y8EuyabmzIqx6dxGHvoeYIdkN2vO+gxn UlStLJDYm3K+1glNOU135o2Q=
- In-reply-to: <58416e33-7574-4750-8c40-b64d3cfb2cdd@isolution.nl>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <c6d6d53a-c300-412a-b1da-5eae7b50b78f@isolution.nl> <Z9BMyHkKNfWriiiK@seventeen> <58416e33-7574-4750-8c40-b64d3cfb2cdd@isolution.nl>
On Tue, Mar 11, 2025 at 04:00:13PM +0100, Ruud H.G. van Tol wrote:
> On 2025-03-11 15:46, Bill Allombert wrote:
> > On Tue, Mar 11, 2025 at 03:27:28PM +0100, Ruud H.G. van Tol wrote:
> > > The user manual states:
> > >
> > > 2.7.2 [...] If an argument is prefixed by a tilde ~ in the function
> > > declaration and the call, it is passed by reference. (If either the
> > > declaration or the call is missing a tilde, we revert to a call by value.)
> > Actually it depends if the variable is lexically or dynamically scoped.
> > Please do not forget the ~!
>
> But with a dynamically scoped L:
>
> ? L=List([1,2,3]); print(L); listinsert(L,42,1); print(L); listpop(L,2);
> print(L);
> List([1, 2, 3])
> List([42, 1, 2, 3])
> List([42, 2, 3])
>
> the missing ~ appears to work fine.
The reason is that listinsert and listpop are C functions, which are
prototyped.
But please really do not omit the ~, at some point PARI will require it.
Cheers,
Bill.