Re: Flexichain library specification
Luke Gorrie <[email protected]> Sat, 13 Mar 2004 21:49:09 +0100
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
Robert STRANDH <[email protected]> writes: > Hello, Howdy! > Matthieu Villeneuve and myself have been working on a library for > storing sequences of objects such that objects can be efficiently > inserted in and deleted from the sequence. [...] > We decided to write this library because something with this > functionality is often needed, as is evident from the numerous times > people (including myself) have come up with less efficient and less > general code for a subset of this functionality. I don't think it's always a subset though. Your interface looks similar to Emacs (one linear chunk of text with markers/cursors), but different to Hemlock and Goatee (doubly-linked list of 'line' objects each containing some text). Other possibilities exist too -- e.g. immutable (copy on change) versions which can give you 'undo' for "free" (check out Boehm's 'cord' structure [1]). Each design makes some things easier, some harder, and some just different. I reckon that experimenting to find the best interface to build the rest of the editor around is the worthwhile part of editor hacking -- it would be a shame to standardise it away. (I also prefer the Hemlock interface to the Emacs one, and hear tell that the Dylan editor has improved things further, so I'm not sure that Emacs would make the best model in either case.) Performance could be an argument in favour of a premade library, but don't the simple data structures tend to have adequate performance in practice? Just my two cents.. Cheers, Luke 1: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/cordh.txt