From: Nikolai Weibull Date: 2003-10-10T02:36:46+09:00 Subject: Re: Extension Language for a Text Editor * Simon Strandgaard [Oct, 09 2003 09:09]: > What a coincidence.. I am also writing a programmers editor (AEditor) > in Ruby. > http://aeditor.rubyforge.org/ Yes, I have seen it, and tried it (see below). > > > 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 ? ;-) eh, it was included in the end of the mail (marked [3]) ;-) http://www.pcppopper.org/code/win/sled/ > http://sourceforge.net/projects/slackedit This is very old. Do not use ;-) > Your Trove-info says 'gnome', but no unix install. No, the plan was to port it to Gtk/GLib, but that never happened. > > > 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!! > Yeah, it is very nice and simply done. I like your code. I see you've read your GOF well ;-) (especially the first chapter I presume ;-). I do, however, feel that you've gone into it a bit too much. I mean, It's fine to represent lines as object, but individual characters? It gets a bit big at that point ;-) > > > * 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. > Well, if you take a look at the undo/redo code for Wily and Sam, they are actually not very large. Using the Command pattern is very clean and OO though. > > 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. > Intuitive in general, yes. But is it intuitive in this context. Are there any obvious winnings by using it? Can you forsee syntax definitions and indentation definitions easier to write in Ruby than in LISP? Why? How? > > > * LISP? > > not enough intuitive. > Hehe, OK ;-). I've just started getting interested in Lisp, shunning it in the past as an Old-Fart Language. It just seemed to arcane for me. Then I realized that it's a language that's had all these features we only now see making their way into mainstream languages. I mean, look what Matz has to say about it: "Some may say Ruby is a bad rip-off of Lisp or Smalltalk, and I admit that. But it is nicer to ordinary people." - Matz, LL2 OK, this may be true. 1 + 2 is easier to read and understand than (+ 1 2), but you can't do 1 + 2 3 and expect it to work ((+ 1 2 3) does). I guess, that, in the end I'm just pushing Lisp here because I am interested in it and want to give it a try. Ruby is great, but I already know Ruby ;-). I'm trying to get someone to push me back into the Ruby camp :-D. > > > * 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 :-) > Yeah, but I want the language that makes it simpler to move as much out to the extension language as possible. > > > * 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 :-) > Yeah, I tried opening this rather large text file (In The Beginning Was The Command Line) and it started thrashing my hard-drive (just loading it (a file of perhaps 200K?) since it required 130MB to load it started swapping. > > > * 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++..? > OK. > Overloading Regexp... I don't know. > I am currently writing my own regex engine. OK, interesting. > What features do you plan for your editor ? > Is it a programmers editor, or a propertional font editor ? It's a general editor, of course aimed at programming. Proportional text is for whimps ;-) nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}