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

Re: [Scheme-reports] [scheme-reports-wg2] Re: Requesting early review of a character sequence library



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.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports