[REBOL] Series Index Discussion (Was: Core 2.5.5. Beta)
From: carl:s:rebol at: 25-Feb-2003 11:31
WRT the series discussion that pops up every year on this list:
1. Typically, this discussion is between the same three people who discuss
the merits of other indexing methods and theories. It's a good discussion, but
most developers are too busy writing programs to care.
2. The current series index implementation is based on performance, not strict
theory. Such tradeoffs are necessary in all language implementations.
In other words, there are good reasons why we are not all writing code in LISP
and Smalltalk today, despite the beauty of both languages, which we know well.
3. We seriously doubt (but remain open minded) that any change can make the
implementation of series indexing "faster" internally (as stated in prior
messages).
Indexing as implemented in REBOL today is very high speed, which is why there
is no penalty for writing code that uses HEAD, HEAD?, TAIL, TAIL?, INDEX?,
LENGTH?, PICK, etc. They all have identical performance: fast (unlike a
language
like C for instance). So, beware of other claims.
4. We treat "going past the end" of a series as an exception. Fundamental
natives
like PICK handle it by returning NONE. Secondary natives handle it by
causing an
error (e.g. FIRST, SECOND, THIRD, etc.). This is done so you don't have to
write
special code every time you use FIRST, because if you did, you might as
well use
PICK or LENGTH?. The FIRST native would not offer a coding advantage.
5. It has been proposed that there are three functions that would provide a
more
flexible method of indexing series. We are willing to make these into
Natives if
that is possible (that is, they don't require changes to existing datatype
formats,
they don't require special static storage per series that must be managed
and garbage collected, and they can be applied to all series datatypes, not
just
blocks and strings, but also to hashes, lists, ports).
To make this happen, send us a concise description and algorithm of each native
function (such as a mezz function that does it). We will take a look at them.
Please use REBOL naming conventions for function names (e.g. verb first,
obvious
names, etc.).
We'll let you know what we decide.
-Carl Sassenrath
REBOL's Designer
PS: it is considered good mail list netiquette to change the subject line
for long running
discussions that are off the original topic.