Max Alekseyev on Wed, 13 Mar 2024 20:17:55 +0100


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

Re: Avoid using "listput()" if possible?


What's then the purpose of ~ if functions work only with references anyway?
Is it planned for the modifying functions to create a copy of the object when ~ is not used?

Regards,
Max

On Wed, Mar 13, 2024 at 3:03 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
On Wed, Mar 13, 2024 at 01:58:02PM -0400, Max Alekseyev wrote:
> Hi Bill,
>
> Why is this explicit specification for the object reference required for
> listput() ?

Because it modifies its argument.

> What happens if ~ is missed?

Currently, nothing happen for backward compatibility reasons...

> It looks like functions that don't modify the object (like
> mapget()) implicitly work with references, with no need to specify ~.
> Please confirm.

Correct. mapget does not modify its arguments so is not concerned.
All functions works with references, however most of them do not
modify their arguments.

Cheers,
Bill