On 2014/01/12 08:05:30, Devon Schudy wrote:
David Kastrup wrote:
> At any rate, I'm not really happy with the macro usage at top level
> here: I think it would be better if the basic assembly was rather
done
> by music or Scheme functions

I'm not really happy with it either, because users have no hope of
modifying it or learning from it. The macro-generated version is much
shorter, but that's not worth the inability to copy and modify. I
rewrote it using functions, but that's not much easier for users, and
is almost as long as the original version with no attempt to factor
out the repetition.

The reason for the macros is so the definedness of variables can be
checked at macroexpand time, to avoid compiling references to
undefined names — that works in Guile 1.8 but not in Guile 2, and it's
bad style anyway.

Checking for the definedness of variables at macroexpand time?  Ugh.

How about
define-variables =
#(define-void-function (parser location syms) (symbol-list?)
   (for-each
      (lambda (sym)
        (if (null? (ly:parser-lookup parser sym))
            (ly:parser-define parser sym *unspecified*)))))

If you write \name for a variable with value *unspecified*, it simply
disappears in the lexer.


https://codereview.appspot.com/41990043/
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to