|
From: | Hans Aberg |
Subject: | Re: initial .ly files [was Re: *.mid vs *.midi] |
Date: | Sun, 18 May 2008 01:00:40 +0200 |
On 18 May 2008, at 00:24, Karl Hammar wrote:
This would walk down the path of C-like compilers.Is that a bad thing?
It means only that it might be a good idea to think very carefully before walking down that path :-). C is a very old language, with a simple setup, leaving much to the user how to pick things together.
Actually what I would like is some way to tell on the command line that this run should have /ancient fonts/c-clefs/modern clefs/... so I couldeasily switch style without having to write a new file.
With a module system, one might write some like import font.ancient.c-clef.modern which is easy enough to change from within the file.Now, to fix this from the command line, one way is like in "make", setting variables which have effect within the program. In LilyPond, one might define a Scheme function with a constant, and define that constant from a startup argument, like in
lilypond --scheme<...>or something. Or it could be a a macro preprocessor like in C - M4 is a popular choice. But preprocessors are only there as a tool to fix things that cannot be hadnled from the language.
Have you checked out Haskell <http://haskell.org/> and the compiler GHC? - Haskell has a module system, which makes it possible for GHC to compile by ghc --make a.hs where "a.hs" is a file containing a "main" function. By the module system, it is possible to deduce what files to include. One then only needs to set the library paths somewhere.There is some kind of "library path" in lilypond to find e.g. "gregorian-init.ly" which I don't have in the current directory.
The module import system is different from file includes in that the language knows what modules have been imported, and also keep names from different modules from clashing.
So, for example, one can make the order of module import declarations irrelevant. But with file include, one needs to make sure they are include in the right order.
Hans
[Prev in Thread] | Current Thread | [Next in Thread] |