| How to extend C programs with Guile | ||
|---|---|---|
| <<< Previous | Next >>> | |
Configuration files and macros are common instances of extension languages. An extension language is a (usually) interpreted language built into a program that allows some behaviors of the program to be modified even after it has been compiled and distributed.
Although there are exceptions, extension languages are often simple and not feature rich.
Guile was conceived from the very beginning as an extension language, but, not a toy language. Instead it was to be a complete and powerful language that could be used for extensions.
In a way, this noble strategy has been part of why it hasn't received greater acceptance. Many of those that have started out looking for an extension language have ended up hacking entirely in Guile. Much of the work on that language has been to expand its stand-alone capabilities, which are considerable.
Thus, much of the Guile code out in the wild isn't a strong example of the power of Guile as an extension language. Notable exceptions are FIXME.
In this chapter I hope explain what an extension language is, how it is a practical solution to common programming problems, and what could be the division of labor between C and Guile in a hybrid application.
Extension languages have been a staple of computing for quite some time.
Lotus Notes has a language for Agents, user-modifiable programs that are run when new mail is received or are triggered on a schedule.
Microsoft Office allows a user to write macros in Visual Basic which can be called to automate documentation tasks.
Many games has scripting languages that help determine the events of the scenarios or the behavior of the AI. Baldur's Gate, Black and White, and Icewind Dale are examples of games that have scripting languages for AI behavior or for scenario events.
GNU EMACS has a LISP-like extension language. In EMACS, the majority of the functionality is written in the extension language, and only the lower-level work is done in C.
Perhaps hundreds of Unix or GNU/Linux programs have configuration files that are read in when the program is executed. A configuration file could be considered to be a primitive extension script.
| <<< Previous | Home | Next >>> |
| Acknowledgements | Visualizing a Hybrid Application |