[Cuis] Ropes & Unicode

Ken Dickey Ken.Dickey at whidbey.com
Sat Feb 16 16:41:57 CST 2013


On Sat, 16 Feb 2013 18:00:19 +0000
"H. Hirzel" <hannes.hirzel at gmail.com> wrote:

> I think I need a bit more instructions how the class Rope [1] is
> supposed to be used.

Basically, it should look like a String until you look unto the details.

I did add Character>>asRope and String>>asRope and #, to make things easier.

> Should the Rust language Ropes API
>     http://static.rust-lang.org/doc/0.5/std/rope.html#type-rope
> be taken as a model for the Cuis implementation?

I have been looking at the Rust code.  I find it a bit verbose.

Given the breadth of the current String API, I don't see the need to add much.

Note that in general we have most of the Rust functions already:

char_at ==> #at:
char_len ==> #size
eq ==> #=
iter_chars ==> #do:
...


> I would say a high priority is
> 
> a) Rope construction (i.e. appending and prepending instances of
> Character and String)
> b) streaming over a Rope. This is a typical operation when you deal
> with a large text file.
> c) finding a subrope

Agreed. I need to fill out the rather large string protocol/API.

As another example, Ceder/Mesa used "lazy" ropes for editing large text files.  My recollection is that Cedar used ropes only and everywhere -- no separate string type.


> I actually would expect the class Rope to have
>    Rope class >> fromString:

Good call.  I'll add it.

The point of this first code was as proof of concept.  I wanted to get enough experience to see if this was worth our time to carry further.  Lazy ropes and other specializations are easy to add.

Like Juan, I was pleasantly surprised to see that using a rope in the text editor was darn easy.

Plenty of details yet, but the first indicators are positive.

Next steps are to go from prototype/proof-of-concept to use-in-place-of-strings.

This will take me a while.  I still have much to learn about paragraph, parsing, and the text editors -- not to mention Smalltalk best practices.


Thanks for taking a serious look at this,
-KenD
-- 
Ken [dot] Dickey [at] whidbey [dot] com




More information about the Cuis mailing list