bug-guile
[Top][All Lists]
Advanced

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

Re: Vectors should not evaluate to themselves


From: Dirk Herrmann
Subject: Re: Vectors should not evaluate to themselves
Date: Mon, 9 Apr 2001 15:12:51 +0200 (MEST)

[I am sending this a second time, since there were some problems with our
mail connection this morning.  Since my mailer completely dropped any
reference to the message, I had to rewrite it from scratch.]


On Sat, 7 Apr 2001, Martin Grabmueller wrote:

> > From: Dirk Herrmann <address@hidden>
> > 
> > > I have done that, but not committed yet.  As I have never touched the
> > > evaluator before, I am not sure if the attached patch is sufficient.
> > > Also, R5RS only defines ``Numerical constants, string constants,
> > > character constants and boolean constants'' (R5RS 4.1.2) as
> > > self-evaluating, so the following cases should be removed, too:
> > > 
> > >     case scm_tc7_smob:
> > >     case scm_tcs_closures:
> > >     case scm_tc7_cclo:
> > >     case scm_tc7_pws:
> > >     case scm_tcs_subrs:
> > > 
> > > and the `struct' part of the following:
> > 
> > Unfortunately, things are not that easy.  Bignums, real and complex
> > numbers are realized as smobs.  Thus, if you want that all numerical
> > constants (and not just immediate numbers) evaluate to themselves, you
> > have to be a little bit more careful here.
> 
> Hmm.  I see.  So what's the way to go?  

It seems to me that we only have to take care of objects that have an
external representation that can be understood by the reader.  This is not
the case for closures, cclo, pws, subrs and most smobs.  For all these
objects it does not matter whether we take out the above cases or not.  
Thus, I suggest to leave in the smob-case and add a comment to it, but
take out all other cases, because it is better not to leave dead code in
there.

(I have not checked, though, whether the patch actually works the way it
is intended to.)

> > Actually, I don't understand the requirement that vectors don't evaluate
> > to themselves.  The fact that it is said explicitly in R5RS is an
> > indication that there must be a good reason for it, but I don't see why.
> 
> I suppose it's for symmetry with lists.  Vectors can be used in
> syntax-case templates like lists, and also in quasiquotations.  But
> that's just a theory, which is by me and is completely mine...

Hmmm...  If it was for symmetry only, then why can you write #f instead of
'#f ?  I still assume that there is more about it.

Best regards,
Dirk Herrmann




reply via email to

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