Email list hosting service & mailing list manager

SRFI 130 - "span" prefix Per Bothner (04 Dec 2015 03:34 UTC)
Re: SRFI 130 - "span" prefix John Cowan (04 Dec 2015 15:54 UTC)
Re: SRFI 130 - "span" prefix Per Bothner (04 Dec 2015 16:10 UTC)
Re: SRFI 130 - "span" prefix taylanbayirli@xxxxxx (04 Dec 2015 16:49 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 07:05 UTC)
Re: SRFI 130 - "span" prefix John Cowan (06 Dec 2015 06:44 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (04 Dec 2015 18:49 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 07:06 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (05 Dec 2015 07:21 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 16:51 UTC)
Re: SRFI 130 - "span" prefix Per Bothner (05 Dec 2015 17:20 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (05 Dec 2015 17:39 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 20:00 UTC)
Re: SRFI 130 - "span" prefix Alex Shinn (04 Dec 2015 16:52 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (04 Dec 2015 20:27 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 00:02 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 07:57 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 13:09 UTC)
Re: SRFI 130 - "span" prefix John Cowan (06 Dec 2015 02:32 UTC)
Re: SRFI 130 - "span" prefix Alex Shinn (07 Dec 2015 19:26 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 19:48 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 20:08 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 20:25 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 20:44 UTC)

Re: SRFI 130 - "span" prefix John Cowan 04 Dec 2015 15:53 UTC

Per Bothner scripsit:

> I really dislike the habit of having separate names for different functions
> that abstractly do the same thing - I think it is very user-unfriendly.
> If a "span" is a sequence of characters, call it what it is: a string.

But "string" already means something in Scheme: a *mutable* sequence
of characters addressable by indexes (such that adding 1 to the index
gets the next character and subtracting 1 gets the previous character
modulo boundary cases).  I'd be happy to rename these functions to
"istring-" on the analogy of SRFI 117 ilists and forthcoming ideques,
isets, and imaps.  Spans are immutable primarily so that they can share
storage with other spans, which is not true of strings as actually
implemented (except on Guile, which has copy-on-write strings).

However, I don't see how you can avoid having separate functions
(or polymorphic functions such that cursors cannot be exact integers)
for the other span operations, which means that instead of span-ref or
istring-ref, you have string-ref/cursors: is that really an improvement?

> (1) a portable implementation that matches more-or-less the current proposal

Will's code actually provides for four implementations, to which I plan
to add a fifth:

(a) spans are strings (no sharing, poor performance)

(b) spans are records with a string and two indexes
    (performs well if strings are simple arrays of characters)

(c) spans are records with a bytevector representing UTF-8 and two
    bytevector indexes (generally best performance/safety tradeoff)

(d) same as (c) but without sanity checks, so performs a bit better

(e) spans are records with a string whose characters represent individual
    UTF-8 bytes via the natural mapping and two bytevector indexes
    (suitable for systems like Chicken where strings are single-byte)

> (2) a portable library that wraps (1) *and* native strings.

It's easy to provide that yourself, given (1).  Scheme is relentlessly
monomorphic[*], partly so as not to hard-code specific type relationships
into the libraries as most languages do.  If you want a library like the
CL sequence library that hides the difference between lists and vectors,
you can easily have one, but the language standards don't compel such
a relationship to exist.

[*] We do have universal case-by-case polymorphism for things like `write`,
and generic arithmetic is polymorphic over exact and inexact numbers.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
Mr. Henry James writes fiction as if it were a painful duty.  --Oscar Wilde