[REBOL] Re: Series Index Discussion (Was: Core 2.5.5. Beta)
From: nitsch-lists:netcologne at: 25-Feb-2003 22:13
Carl Sassenrath wrote:
[snip]
>
> 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).
>
i like the effect of returning 'none when out of series.
allows stuff like
face/text: any[ pick data index "default string"]
but i think the out-of-range trick is a bit hidden.
could it make sense to have versions with and without error-checking,
'pick and 'pick? or something, to code more specific?