On Wed, Feb 05, 2014 at 08:41:43PM +0100, Christophe Gragnic wrote:
> >> The copy can be «by value» or «by ref».
> >> Both available separatly would be great!
> >
> > I'm not sure. Lisp values are always references to cells. Do you mean
> > some kind of 'copy'ing?
> >
> >    (set "Sym2" (copy (val "Sym1")))
> >    (putl "Sym2" (copy (getl "Sym1")))
> >
> > This will copy the top-levels of list arguments (while atomic arguments
> > are just passed through).
> Not sure. I don't understand `copy` enough to tell you.
> This seems to be «by ref» to me (or maybe it's like in Java! refs are
> passed by value (or the contrary!)). See here: the change of the value of a
> is not propagated to b.

That's why I'm not sure either. As I understand it, the terms "by
reference" and "by value" do not apply to PicoLisp as they might do to
other languages.

I would say that the 'copy' approach above is not to be recommended
here. I would not prematurely and unconditionally copy data, but take
care of the issue where the data is _used_ (e.g. being aware of
destructive and non-destructive operations).

As far as the direct values of the symbols 'a' and 'b' are concerned,
you don't need to worry. Changing the value of one of these symbols will
not change the other. But if the value of one symbol is a (perhaps
deeply nested) list or another symbol, then destructive manipulations in
these data will of course be seen in the value of the other. This is
also explained in "The PicoLisp Machine" chapter in the reference in

> Anyway, I'm happy with you alias!

Great. That's what counts :)

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to