Rope is production ready in the narrow sense that AttributedString is using it in production in the variant that recently shipped in Foundation. The implementation is complete inasmuch that it has a real life adopter that is using it to solve a real problem, and it seems to work as we expected it would. The current implementation does have some obvious missing functionality, and (as always) there are some low-hanging performance optimizations yet to be done.

Rope is not ready for general public consumption, though, because its API has not been finalized yet. It isn't even clear to me yet if its API is at the right abstraction level -- in particular, RopeElement being a container type on its own is a major complication that feels too fiddly to consider making public. (This is absolutely crucial for text storage, but it would be a huge source of errors for clients that simply want a persistent array-like container of discrete items.)

My current expectation is that we'll keep Rope underscored, and the package would only expose higher-level container types built on top of it.

  • The module already includes the BigString type, which is definitely at the right abstraction level to make public. (It's "just" a full reimplementation of String's API.)

  • It would be nice to pair that with a public BigArray type that would implement a container of discrete Elements. (With support for finding items at a specified offset, as measured by some customizable metric (a simplified version of the RopeSummary and RopeMetric protocols).) AttributedString's attribute storage rope implementation is sort of an exploration towards BigArray. (I just didn't have time to pull it back down into swift-collections yet.)

I think BigString and BigArray would make a quite good story on their own, even without exposing Rope.

(For scheduling, the swift-foundation project serves as an important force pushing things forward, as that package cannot be used in production until it can stop depending on specific swift-collections commits.)

13 Likes