[plt-scheme] MzScheme: extending vs. embedding to build a text editor

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jul 13 20:56:30 EDT 2008

At Sun, 13 Jul 2008 17:50:46 -0700, "Peter Michaux" wrote:
> On Sun, Jul 13, 2008 at 5:03 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > At Sun, 13 Jul 2008 16:57:12 -0700, "Peter Michaux" wrote:
> >> First, I could write MzScheme extensions [1] for ncurses. The editor
> >> could then be written in Scheme from start to end whatever that means.
> >> It would certainly be a Scheme-centric implementation. I could then
> >> edit a file with the command
> >>
> >>   mzscheme myeditor.ss some-file-to-edit.txt
> >
> > I would do it this way,
> 
> I'm curious why you would do it this way rather than creating a C
> program embedded with MzScheme. Is it simply to avoid having to write
> any C code?

Partly. Writing an embedding executable is a lot more work than just
writing a Scheme library/program. Also, creating an executable via C
requires more tools, including platform-specific tools, to compile and
link.

> > but probably using `scheme/foreign' instead of
> > creating an extension:
> >
> >  http://docs.plt-scheme.org/foreign/index.html
> 
> Again, is this just to avoid having to write any C code (a wrapper in
> this case)?

Yes. It's easier to write Scheme code that uses the FFI than to write C
code, and it's easier to make the code adapt to slightly different
libraries on different platforms.

Matthew



Posted on the users mailing list.