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

Re: Why vectors?

Derick Eddington wrote:
Why are vectors and not lists used for make-rtd's and rtd-constructor's
fieldspecs arguments and for rtd-field-names's and rtd-all-field-names's
return values?  Is the only reason to follow R6RS's use of vectors?  If
so, I request lists be used instead because they're easier to deal with,
as shown by how much list<->vector conversion is done in the ERR5RS
reference implementation itself.  Using lists instead would increase the
appeal of this SRFI to me, and I think to others also.  IMO,
interoperating with the R6RS records procedures that deal in vectors
without having to convert list<->vector is not a good enough reason
compared to the benefit of using lists with one's primary record system
of use, because interoperating at the procedural level where these
vectors matter will be rare (I imagine).  Or is there a good reason to
use vectors?

Well, of course performance-wise vectors are much more efficient than
lists as a general rule, but it mostly matters for either freequently-
accessed or long-term-retention sequences.  Clearly, the internal data
structures used to represent classes should be vectors.  In that case,
it can be more efficient to have reflective operations also return
(immutable) vectors - at least if return sequences can be the same
as the internal sequences.
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/