[Cuis] Ropes & Unicode

H. Hirzel hannes.hirzel at gmail.com
Mon Feb 18 04:07:22 CST 2013


Hello Ken

On 2/16/13, Ken Dickey <Ken.Dickey at whidbey.com> wrote:
> 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.

This is easier indeed. Thank you.


>> 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:
> ...

This made me use #do: in one of the performance tests, see the
performance test thread. I consider iterating through all the chars in
a Rope a typical operation I need.


>
>> I would say a high priority is
>>
>> a) Rope construction (i.e. appending and prepending instances of
>> Character and String)

OK, as for now

>> b) streaming over a Rope. This is a typical operation when you deal
>> with a large text file.

OK, as for now.

>> c) finding a subrope

This is what I am interested in next. The general String find. And
maybe #splitBy:

BTW could you provide the links to Java, Python and C implementations
of Ropes so that I can have a look at it as well?

> 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.

Thank you, this makes using Ropes effortlessly.  I used in in the
performance tests. I only need to know about class Rope for getting
started.

Maybe we should complete API the subclasses provide in the class Rope
as it is done in String in Squeak (String is superclass of ByteString
and WideString in Squeak).

> 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.

What is "lazy" in lazy Ropes?


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

Yes.

> 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.

Yes.

> This will take me a while.  I still have much to learn about paragraph,
> parsing, and the text editors.

With paragraph parsing you mean finding where the paragraph boundaries
are? It might be worthwhile considering using paragraph boundaries as
end points for Ropes?

 -- not to mention Smalltalk best practices.
Sure but people here are willing to help with their knowledge.


>
> Thanks for taking a serious look at this,

You are very welcome.


Regards
--Hannes




More information about the Cuis mailing list