Re: [LogiLogi-list] Position ranges
Status: Beta
Brought to you by:
wybow
|
From: Wybo W. <wy...@lo...> - 2007-04-25 09:26:03
|
I've been thinking about how we should refer to positions and ranges in
Logi's.
This is relevant for a manta plugin that allows one to see place-names
mentioned in a logi on a map that is shown below. This module is my
final assignment for a course in which we have to work with Geographical
information.
Currently position-ranges refer to the characters they span in a way
that is intuitive for humans, but not standard in computer-science,
namely to the characters (like in Ruby ranges including the last
position: 1..1), and not beyond them (like in C strings, and in Ruby
ranges excluding the last position 1...2).
The point is that pointing to positions between characters is easier
with the C-ranges than with the ones we currently use. And we want to
be able to refer to positions between characters in order to be able
to add things just after (or before) words, like a little globe behind
a place-name one can click on to center the map around it. Pointing to
the whitespace just before or after a word is not an option, as after
the diffing the same whitespace is not guaranteed to stick with the
same word in relative space ('a duck', diff with 'a big duck', and the
whitespace after 'big' is gone (because the substring 'duck' was longer
than 'a')).
With the C-style notation we can refer to positions just before or
after a word by giving zero-ranges, like 1...1.
In the example: 'a big duck' 2...2, and 5...5 could refer to the
positions just before and just after 'big'. Of course for this to work
we would have to make sure that the diff always keeps the same white-
space at the end of each word.
What do you people think of this, and especially Charl, as you will be
the one creating C++ implementations of the diff (and thus also of the
position-range classes).
greetings,
Wybo
|