guile-devel
[Top][All Lists]
Advanced

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

Re: truth of %nil


From: Mark H Weaver
Subject: Re: truth of %nil
Date: Wed, 2 Sep 2009 11:57:27 -0400

Neil Jerram wrote:
> > One more thing: scheme code can reasonably expect to "write" a list of
> > simple values and then "read" it back in.  But now, lists might be
> > terminated by %nil instead of '().  Therefore, I think "read" needs to
> > be able to read SCM_LISP_NIL in whatever form we "write" it in.  I'll
> > let someone more knowledgable about guile reader issues decide what
> > that form should be.  Currently we write it as "#nil".
> 
> Interesting point, but seems like one that could be left until it
> crops up for real somewhere.
> 
> I assume the mainline case of writing a proper list will be fine,
> because a list like (a b c . #nil) will be written out as "(a b c)" -
> right?  Then, when read in again, it would become (a b c . ()) - I
> think we may have to wait for real cases to know if that's actually a
> problem at all.

Certainly writing (a b c . #nil) as (a b c) would be most natural and
convenient, and maybe it's the best compromise, but I'm not entirely
sure it's safe.

What if we have an association list mapping symbols to booleans that
came from elisp?  Such a alist might look something like
((a . #t) (b . #nil)), and can reasonably be assumed to be written
and then read back in, but doing so would then result in
((a . #t) (b . ())), magically changing the false to a true.
This also violates the idea the CARs and CDRs should be treated the
same way.

I'm tempted to suggest that "write" should write (a . #nil) as
"(a . #nil)", and "display" should write it as "(a)".

   Best,
    Mark




reply via email to

[Prev in Thread] Current Thread [Next in Thread]