string type =========== what other programming languages / stdlibs do or have done: - shortstrings (byte length + merged data) [old Pascal] - modifiable refcounted (refcount + length + pointer) [new Pascal] - raw null-terminated [C] - immutable object, garbage collected (length + pointer) [Java] # With a enum it requires an extra field! type String = case ( .ShortString ( byte length, [length]byte data, ) .MergedString ( size length, [length]byte data, ) .MergedZString ( # TODO ), .CompressedString ( # we need a compression algo that: # - decompresses quickly # - does not need much overhead for dictionaries etc. # - is suitable for deterministic compression (like UTF-8 there might be overlongs) size clength, [length]byte data, ) .ReadOnlyView ( size length, ref [length]byte data, ) ) # we can have an immutable string type as a standard string type # and another type that allows modification, and can be converted to an immutable string