[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \apply nest-props Re: constructive criticism
From: |
Han-Wen Nienhuys |
Subject: |
Re: \apply nest-props Re: constructive criticism |
Date: |
Tue, 13 Jan 2004 13:58:44 +0100 |
address@hidden writes:
> I don't know much about scheme coding style and habits. However, in,
> say, Common Lisp, it is not bad style to have both macros and
> functions, as they achieve different purposes.
> [..]
> which is less eleguant. You can *always* do without macros (eh, very
> few languages have such a system), but they allow to build a new
> syntax that captures your application specificities. (I'm not sure
> about the englishness of that sentence, pardon).
I think your reasoning for choosing macros over functions is sound.
However, a newbie like me finds it a little confusing when functions
and macros follow similar naming conventions. I would propose some
kind of naming scheme, such that you can tell whether a symbol
represents a macro or a function.
> I was recently thinking about tying to fill some of the TODOs in
> scheme source files. One of them is about markup command built by
> users, what they have to do, etc.
>
> - define a function named COMMAND-markup
> - describe its signature
> - the TODO is that it has to be defined in this new-markups.scm
> file.
>
> Here, a macro would be fine. Something that lets you write for
> instance:
>
> (def-markup-command raise (number? markup?)
> "Syntax: \\raise AMOUNT MARKUP. "
> "Maybe a longer documentation here..."
> (lambda (paper props . rest) ;; maybe not required, as it is a
> ;; common pattern
> (ly:molecule-translate-axis (interpret-markup paper
> props
> (cadr rest))
> (car rest) Y)))
>
> That would generate the function definition, and add the command
> signature to markup-functions-and-signatures. def-markup-command
> introduces a new syntax that is specific to your application
> domain, eg markups. it is imho clearer than a function where you would
> have to quote all arguments. Syntax matters in LilyPond, so, when
> writing scheme code for lily, adding clearer syntax thanks to macros
> is a plus.
Yes, def-markup-command would very cool. Can you do that?
Probably something similar goes for the grob-property-description
function.
--
Han-Wen Nienhuys | address@hidden | http://www.xs4all.nl/~hanwen