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: Martin Grabmueller
Subject: Re: Vectors should not evaluate to themselves
Date: Sat, 07 Apr 2001 18:57:15 +0200

> From: Dirk Herrmann <address@hidden>
> Date: Fri, 6 Apr 2001 18:33:48 +0200 (MEST)
> 
> On Fri, 6 Apr 2001, Martin Grabmueller wrote:
> 
> > > From: Mikael Djurfeldt <address@hidden>
> > > Date: 05 Apr 2001 01:12:28 +0200
> > > 
> > > Martin Grabmueller <address@hidden> writes:
> > > 
> > > > according to R5RS, literally entered vectors do not evaluate to
> > > > themselves and must always be quoted.  Guile does not detect this
> > > > error:
> > > > 
> > > > guile> #(as)
> > > > #(as)
> > > > 
> > > > Should this be fixed, and can it be fixed easily?
> > > 
> > > It should be fixed and it is easy to fix.  We only need to remove a
> > > case in a switch at the top of the evaluator.
> > 
> > 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?  

> 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...

Regards,
  'martin



reply via email to

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