Marius Vollmer wrote:
>
> scm_copy_tree is too much, since it makes the following code fail:
>
> (let ((a '(1 2 3))) (letrec ((x a) (y a)) (eq? x y)))
>
> We should not copy the values themselves, just the storage cells;
> thus, scm_list_copy is the right thing here.
Yes, I see that now.
> But should we make that change? I am not sure. It causes some
> significant run-time overhead for an obscure benefit. For now I'll
> just put in some comments in eval.c and r5rs_pitfall.test.
I'm not sure it's that obscure, and it seems a shame to leave this as
ammunition for those who like to claim that Guile is not R5RS-compliant.
Is it the performance you are concerned about, or the extra consing?
Surely there must be other things we do for "correct Scheme behaviour",
that have a similar cost to a scm_list_copy?
Two further thoughts that could help us here:
(1) If the environment could be made copy-on-write, we could do the copy
only when actually needed. (But I have no idea whether this is feasible.)
(2) We could provide a 'strict-r5rs option, and use it to decide whether
to do the copy. (In practice, 'strict-r5rs would probably only be on by
default in Guile's implementation of the SRFI-22 scheme-r5rs interpreter.)
Regards,
Neil
_______________________________________________
Guile-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-devel