Why TeXmacs uses Scheme as its extension language

At a first glance, the choice of Scheme as an extension language for TeXmacs may seem a bit strange for people who are accustomed to more conventional programming languages, such as C++, Java or Python. In particular, its heavy use of parenthesis frightens more than one person.

Our choice of Scheme has been motivated by the fact that the language is highly flexible in several ways:

  1. It is easy to mix programs and data in a common framework.
  2. It is easy to customize the language itself, by adding new programming constructs.
  3. It is easy to write programs on a very abstract level.

The first two features are very particular important for extension languages. Indeed, one major use of extension languages is to store data for the application (like keyboard shortcuts and menus) in an intelligent way. Furthermore, the application usually provides some very typical features, which may need to be reflected at the level of the extension language.

For the first two features, the simplicity of the parenthesized notation used by Scheme is also an advantage. Indeed, consider the following fragment of the definition of the File menu:

(menu-bind file-menu

("New" (new-buffer))

("Load" (choose-file load-buffer "Load file" ""))

("Save" (save-buffer))

...)

The entries of the menu (the data) and the corresponding actions (the programs) are very readable using the bracket notation. Similarly, when defining a new language primitive, the systematic use of the bracket notation relieves the user from the burden of making the corresponding changes in the parser.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".