This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: eval'ing a self-referential vector


   From: Jim Blandy <jimb@red-bean.com>
   Date: 16 Jul 1998 11:19:24 -0400

   > This eventually uses up all stack space.
   > I'm guessing scm_copy_tree is infinitely calling itself due to the
   > self-reference.

   Sounds like a good guess.  Eval isn't expecting anything cyclic.

   > Question: why copy vectors when eval'ing them?

   No reason.  scm_copy_tree should probably detect circularities.
   There's a treeish variant of the tortoise and hare algorithm we could
   use.

I was expecting a reply saying either the eval of a vector
is a domain error, not that the error need be detected (is it? a
glance at r5rs suggests it is though guile can certainly provide a meaning)
or that the copy must be made for some reason and supporting self-referential
vectors is undefined or some such (like for equal?).

But, I'll take your reply at face value ...
If there's no reason, I'll repeat my question: why copy at all?
Why not just have scm_copy_tree return vectors unchanged?
(this assumes there are no other users that depend on this behaviour so
the obvious implicit assumption is that if there are then eval would call
something else).