lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the deal with the module system?


From: Han-Wen Nienhuys
Subject: Re: What's the deal with the module system?
Date: Mon, 23 Nov 2009 12:17:20 -0200

On Mon, Nov 23, 2009 at 11:56 AM, David Kastrup <address@hidden> wrote:
>
> Hi,
>
> in the course of seeing how much code can be shared between
> define-builtin-markup-command and define-markup-command, the main
> difference appears to be scope.
>
> That's not much of a problem: just call the defining command, then
> (export ...) the result.  Except that lilypond jiggles with symbols and
> procedure properties and similar in some functions.  I quote:
>

The Lilypond language has a concept of scoping, ie you can do


  foo = 1

  #(begin
     (display (+ foo 2)))

with \paper, \midi and \header being nested scope inside the .ly
file-level scope. "foo = 1" is translated in to a scheme variable
definition.

This implemented using modules, with each scope being an anonymous
module that imports its enclosing scope's module.

The reason to put some functions ("builtin") outside the .ly level, is
that in case of

 lilypond a.ly b.ly

we want to reuse the built-in definitions, without changes effected in
a.ly leaking into the processing of b.ly


> Being cleverer than the platform one is working on is a recipe for
> unmaintainability.  It will also get in the way of using Scheme
> compilers, debuggers and similar tools.
>
> So where do I get to know about the design goals and benefits?

--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]