Re: [scheme-reports-wg2] Re: [Scheme-reports] Requesting early review of a character sequence library John Cowan (24 Dec 2014 02:01 UTC)

Re: [scheme-reports-wg2] Re: [Scheme-reports] Requesting early review of a character sequence library John Cowan 24 Dec 2014 02:01 UTC

Alex Shinn scripsit:

> The problem is you force a duplication of APIs.

I hear you loud and clear, as Olin used to say in these
situations.  I have abandoned the string API in favor of
just the span API, and moved the current description to
<http://trac.sacrideo.us/wg/wiki/CharacterSpansCowan>.  However, I will
retain the string API in the sample implementation, so that those who
want it will have it.

> If you introduce string cursors you can use the same APIs and either
> ignore the start/end arguments or convert if the source and target are
> using different conventions.

Yes, though that conversion isn't free: you have to do an unbounded
amount of work to convert cursors to indexes or vice versa, and if
your target API does not accept either cursors or indexes, you end up
creating new strings anyway.

> However, if you introduce a character-span type you either need two
> versions of every API or you need to convert from spans to strings,
> which is potentially expensive.

No more so than in the cases above, at least when spans are implemented
as a string and two cursors.  I have modified the language so as not to
suggest that other implementations of spans are equally appropriate.

--
weirdo:    When is R7RS coming out?
Riastradh: As soon as the top is a beautiful golden brown and if you
stick a toothpick in it, the toothpick comes out dry.

--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-wg2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.