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

Fill-pointers and sequences



It seems to me that this is a question of what abstraction we want to
associate with the concept of a "sequence": when a vector is treated as
a sequence, is the sequence only that part of the vector up to the fill
pointer, or the whole thing?  I think that we have pretty consistently
adhered to the former view.  The :start and :end defaults suggest this,
as do the definitions for functions like Length.  Aref is allowed to
reference past the fill pointer, but this is noted in the manual as an
exceptional case.

So if we want to be consistent and minimize confusion, I would argue
that sequence functions should signal an error (or at least that it
should "be an error") if we try to make such functions access past the
fill pointer.  This supports the abstraction that moving the fill
pointer changes the legnth of the sequence.  I think that's what we had
in mind when we put this stuff in, though of course we might not all
have had the same things in mind.

As an additional argument, on page 295 of the manual it says the
following: "Nearly all functions that operate on the contents of a
vector operate only on the active elements.  An important exception is
Aref ..."  A good lawyer could wiggle out of this, but it seems that
this is trying to tell us that vanilla sequence functions should not be
allowed to do things to elements past the fill pointer.

-- Scott