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

From: Peter Michaux (petermichaux at gmail.com)
Date: Sun Jul 13 20:29:11 EDT 2008

On Sun, Jul 13, 2008 at 5:04 PM, Chongkai Zhu <czhu at cs.utah.edu> wrote:
> I strongly recommend MzScheme extension.

What is the reason for this strong recommendation? That is really what
I would like to understand in general: why one way and not the other.

Thanks,
Peter


> And yes, PLT Scheme can compile
> program to native binary, but I think bytecode + native binary loader is
> faster.
>
> Chongkai
>
>
> Peter Michaux wrote:
>>
>> Hi,
>>
>> Suppose I wanted to build a text editor like emacs where the use is
>> able to extend the editor using MzScheme (rather than emacs-lisp.) It
>> seems there are two main ways this could be done.
>>
>> -----
>>
>> 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
>>
>> (The whole program with could be compiled to a native binary somehow?)
>>
>> -----
>>
>> Second, the opposite way would be to write a very small C application
>> and embed MzScheme [2] into that application. I could expose the
>> ncurses API by creating and adding ncurses procedures to the embedded
>> Scheme environment. The C could then load some "myeditor.ss" file into
>> the Scheme environment and the majority of the editor program could be
>> defined in Scheme. Since I would be compiling a C program the editor
>> could be started with
>>
>>  myeditor some-file-to-edit.txt
>>
>> -----
>>
>> I've toyed with some other extensible/embeddable languages and the
>> same problem arises. I'm not sure which way around would be the right
>> way to go. I'm interested in what others would do or if there is an
>> obvious definite answer I don't know because I am new to MzScheme.
>>
>> Thank you,
>> Peter
>>
>> [1]
>> http://docs.plt-scheme.org/inside/overview.html#(part._.Writing_.Mz.Scheme_.Extensions)
>> [2] http://docs.plt-scheme.org/inside/overview.html#(part._embedding)
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>
>


Posted on the users mailing list.