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

Re: Substrings

Here is my asshole:

    ...and also consistent with my preference for
    half-open intervals (reflected all over the place inside T already),
Hear here.  Half-open intervals are God's gift to programmers, especially
when you have more than one.

I like SUBSTRING and SUBSTRING-FROM-END;  say what you mean and mean what
you say.
    There is the question of whether the substring should be shared... T is
    kind of schizophrenic on the question of whether strings are to be
    considered mutable objects; shared substrings are quite efficient, but
    ya gotta be careful.  I need to think about this some more.  It's
    especially hairy because string headers are mutable independently of
    the block of characters they point into.

If T is going to be a system's programming language, it really needs both
for applications doing heavy string processing (e.g. the U editor), until
such time as GC and memory are no longer a worry (Ha!).  And the semantics
of strings ought to be explicit-- i.e. a string has two parts, a header
and some text, the header has a length, the text may be shared, etc.

One way of making shared substrings easier to program with is to have
two different kinds of strings-- strings, which have their "own" text,
and substrings, which share the text of some other string or substring.
Both have the same set of operations on them.  That way, the program and
the programmer can distinguish what is shared and what isn't.