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

Re: strings draft



Tom Lord <lord@xxxxxxx> writes:

> Well, I don't think it's that simple.
>
> It would be hard to implement those "string reference objects" to
> preserve the O(1) property in the face of STRING-SET! given a flat, 
> variable-width, string representation.
>
> And if you have a tree representation or something like what I
> described for Pika -- then you don't need those "string reference
> objects" after all.   They might be nice for indepenent reasons -- but
> you won't need them to get O(1) string-ops.

C++'s standard library provides the iterator idiom for it's container
types with the restriction that certain modifications to the container
cause the iterators to be invalidated.  For example, a vector,
random-access container using C's builtin array format, may use simple
pointers into the array as the iterator type.  However, because an
insertion or deletion from the array may cause the pointer to now
point to a new element in the array or if the operation needs to
realloc the memory, the pointer may not even be valid now.

> In some sense, I think that the strong recommendation for O(1)
> string-ops is already present in the spec.   Were it not, why wouldn't
> the string syntax be a fancy way to write lists and STRING? and LIST?
> not disjoint?

Why are STRING? and VECTOR? disjoint?

-jivera