[plt-dev] try out Scheme-implemented editor classes

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 30 11:35:16 EDT 2009

The Scheme re-implementation of the `editor<%>' classes is now
essentially complete. You can try it by building and running from


instead of the SVN trunk. You should try this if you're responsible for
code that uses the classes from sections 2.5 of the `scheme/gui'
reference manual.

Running branch should look just like running the trunk (as of sometime
last week), because this isn't the whole MrEd re-implementation. The
widget and drawing classes are still as much in C++ as before. But the
text editor and "pasteboard" that you use in DrScheme, Redex, card
games, etc., is now implemented completely in Scheme on top of the
widget and drawing libraries, instead of in C++.

For a given platform, the old editor implementation was about half of
the C++ in MrEd (not counting MzScheme). So, this is a big change, but
it won't look like it from the outside. Ideally, you'll notice no
changes at all unless you look at the source. The point of the change
is that we can more easily move the lower widget and drawing layers
from C++ into Scheme.

If you're curious to compare the old and new code, compare

If you run the branch, then I can pretty much guarantee that you'll
find bugs. The new implementation is 17k lines of Scheme code ported
from 25k lines of C++ code.[*] A new 1.3k-line test suite is much more
than we had before, but it falls well short of good coverage outside
core operations like inserting text or computing layout. There will
still be stupid translation errors, such as an extra pair of
parentheses that cause a boolean to be applied as a function or a
missing default argument on a method declaration. Since the code is now
in Scheme, however, you may find that it's easy to fix a bug yourself,
and I welcome those repairs. Otherwise, send bug reports.

Depending on whether people try the branch and what bugs they find, I
may wait until next week to merge to the trunk.

[*] In my experience, C/C++ programs usually get much smaller when
    ported to Scheme, while 17k isn't much less than 25k. But the
    starting point was relatively high-level C++ code, and the class
    and method structure is essentially intact in the port.

Posted on the dev mailing list.