This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Lilypond, GUILE and Garbage Collection (again)


dirk@ida.ing.tu-bs.de writes:
> 
> BTW:  Han-Wen, some time ago I took a look at the lilypond web pages.  I
> realized that guile is required for building lilypond, but I couldn't find
> any information about the way you make use of guile.  Is it possible to
> create music pieces via guile scripts?  Do you want to change the input
> language to use a more schemey syntax?

No.

GUILE is very useful to build abstraction and configurability into the
backend.  In the past, we had to make a derived class for almost every
concept in the backend.  This lead to multiple inheritance problems
and too much types in general.  Lack of dynamic typing in g++ 2.7 made
things only worse.  Now we can just add and remove attributes of
graphic objects on the fly.   For example, if we want a clef to appear
at the end of the line only, and not if it is at the start or in the
middle,  we add 

	 ('visibility_lambda pre-break-only)

to the clefs property list.  pre-break-only is a function defined in a
.scm initialization file.


Second, we use GUILE for a lazy approach to generating output.  Output
objects are glorified Scheme expressions, eg.

	'(show-character 27)

We can't dump these output objects into a file when they're created,
so they are later evaluated, to produce either postscript

    (\27) show

or TeX code.

   \show{27}

This improves flexibility, modularity (the output objects don't have
to be aware of different output formats) and makes debugging the
output routines easier: we don't have to recompile.


-- 

Han-Wen Nienhuys, hanwen@cs.uu.nl ** GNU LilyPond - The Music Typesetter 
      http://www.cs.uu.nl/people/hanwen/lilypond/index.html