From: Simon Strandgaard Date: 2003-10-09T06:10:32+09:00 Subject: Re: Extension Language for a Text Editor On Thu, 09 Oct 2003 06:06:32 +0900, Nikolai Weibull wrote: > OK. So I'm going to write a text editor for my masters' thesis. What a coincidence.. I am also writing a programmers editor (AEditor) in Ruby. http://aeditor.rubyforge.org/ > In my previous editor (slackedit/sled[3]) I used > Tcl[4] as an extension language, and it proved very easy to use, but I > never got far enough to actually give it a good run. where is the homepage ? ;-) http://sourceforge.net/projects/slackedit Your Trove-info says 'gnome', but no unix install. > Do you figure Ruby to be a good extension language for a text editor? My original plan were to use Ruby as an extension language and write the core in C++... At some point started experimenting using Ruby for everything, and now I have actually written AEditor completely in Ruby!! > * What would be easier to do using Ruby? undo/redo/macros.. The code which is responsible for this only takes up 119 lines of Ruby code. This is more complex in C++ because you cannot #clone arbitrary objects. unittesting: AEditor has about 440 testcases and 1400 assertions. unittesting is annoying in C++. In Ruby its easy. It would be easier for users of your editor to make changes to the internals of your editor (because Ruby is intuitive). If you have a testharness then they will also could test if their changes has unforeseen sideeffects. > * LISP? not enough intuitive. > * What language allows the most of the editing commands to be written in > the given language? If your editor core is written in a different language than your extension language. Then you will no matter what language chosen, have to make a bridge between. There are shortcuts, such as SWIG. SWIG can generate wrappers for *many* script languages. My vote would be Ruby :-) > * Is Ruby good enough for the task at the moment, performance wise? You can try out AEditor, to feel if Ruby is fast enough. On a 100MHz machine AEditor feels quite Okay. On a 33MHz 486 it can be slow. I can live with this hardware requirements, thats why I choose to write everything in Ruby :-) > * Resource wise? Does anyone have any statistics on this? My datastructure has a huge amount of memory overhead (because it uses an Array of characters). I am in the process of rethinking the datastructure and maybe write a datastructure Ruby-extension module in C++..? > Also, is there any way of redefining the // operator for constructing > regular expression objects? I'm planning on implementing a new regex > syntax for the editor (to make searches/substitutions easier to > describe). Overloading Regexp... I don't know. I am currently writing my own regex engine. What features do you plan for your editor ? Is it a programmers editor, or a propertional font editor ? -- Simon Strandgaard