DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile-tut.info.gz) Two world views

Info Catalog (guile-tut.info.gz) Guile in a Library (guile-tut.info.gz) What is libguile
 
 4.1 Two world views
 ===================
 
 In this manual, I usually jump into examples and explain them as you
 type in the code; here I will digress and ramble for a few paragraphs to
 set some concepts straight, and then let you type (or paste) in fun
 examples.
 
   In 1995, I implemented a large program, "Gnudl", using Guile quite
 extensively.  In the design phase of Gnudl, I found I had to make a
 choice: should the fundamental data structures be C or Scheme data
 structures?  
 
   Guile allows C to see its data structures (scalar types, lists,
 vectors, strings ...).  C also allows Guile to see its data structures.
 As a large program designer, you have to decide which of those
 capabilities to use.  You have two main choices:
 
   1. You can write your software mostly in Scheme.  In this case, your C
      software will mostly parse the Scheme code with Guile calls, and
      provide some new primitive procedures to be used by Scheme.  This
      is what Gnudl does.
 
   2. You can write your software mostly in C, occasionally allowing
      Scheme code to be parsed by Guile, either to allow the user to
      modify data structures, or to parse a configuration file, ...
 
   Mixing the two approaches seems unwise: the overall layout would be
 confusing.  But who knows?  There might be problems that are best solved
 by a hybrid approach.  Please let me know if you think of such a
 problem.
 
   If you use the former approach, we will say that the "master world"
 is Scheme, and the C routines serve Scheme and access Scheme data
 structures.  In the latter case, the master world is C, and Scheme
 routines serve the C code and access C data structures.
 
   In both approaches the `libguile.a' library is the same, but a
 predominantly different set of routines will be used.  When we go
 through examples of libguile use, we will point out which is the master
 world in order to clarify these two approaches.
 
Info Catalog (guile-tut.info.gz) Guile in a Library (guile-tut.info.gz) What is libguile
automatically generated byinfo2html