[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro pre-processing?
From: |
Graham Percival |
Subject: |
Re: Macro pre-processing? |
Date: |
Mon, 1 May 2006 21:59:53 -0700 |
This stuff really doesn't belong on -user, but since it's here anyway,
we might as well finish the discussion here.
On 1-May-06, at 1:37 PM, Nicolas Sceaux wrote:
"Geoff Horton" <address@hidden> writes:
Mats Bengtsson <address@hidden> writes:
As far as I understand, it should be trivial to make a
version of define-music-function where the user doesn't have to add
these arguments manually, so the syntax is
#(new-define-music-function (arg1 arg2 ... ) (typecheck1 typecheck2
... )
#{ ordinary LilyPond code using $arg1 $arg2 ... #}
}
This is manageable indeed :-)
Really? Hmm... what about this?
myMoveText = \function { x:numer? y:number? } {
\once \override TextScript #'padding = #x
\once \override TextScript #'extra-offset = #(0 . y)
}
If we could "disguise" simple scheme functions like this, many more
people would use them.
I think that would satisfy most of my needs.
???
#(new-define-music-function (arg1 arg2 ... )
(typecheck1 typecheck2 ... )
#{ ordinary LilyPond code using $arg1 $arg2 ... #})
satisfies your needs but:
#(define-music-function (parser location arg1 arg2 ... )
(typecheck1 typecheck2 ... )
#{ ordinary LilyPond code using $arg1 $arg2 ... #})
does not?
In all honesty, I'm with Geoff on this one. All the #() stuff looks
scary, and having the "parser location" "non-arguments" (I mean,
they're never referenced in the actual code) was the straw that broke
my back[1]. Now that I have two+ years of at least skimming ever email
on all the mailists, I know that there's a magical "parser location"
thing that needs to be there, and that the "real" arguments come after
that.
[1] I don't know if this phrase exists in other languages. "The straw
that broken the camel's back": there was one tiny problem, but even
though it was very small, it was still enough to cause failure.
I've started to address this problem in the new docs (by providing a
bunch of simple examples and explaining that they need to be there),
but it would be nice if we could remove the "parser location" entirely.
Ok so the real problem is the two extra parameters...
#(defmacro-public def-mus-fn ;; short name for short version :)
(args typechecks . body)
(let ((parser (gensym))
(location (gensym)))
`(define-music-function (,parser ,location ,@args) ,typechecks
,@body)))
If the super-simple version would be a pain to implement, then I vote
that we merge this. Although I'd propose "def-mus-func" for the name.
Cheers,
- Graham
- Re: Macro pre-processing?, Erik Sandberg, 2006/05/01
- Re: Macro pre-processing?, Nicolas Sceaux, 2006/05/01
- Re: Macro pre-processing?, Mats Bengtsson, 2006/05/01
- Re: Macro pre-processing?, Geoff Horton, 2006/05/01
- Re: Macro pre-processing?, Nicolas Sceaux, 2006/05/01
- Re: Macro pre-processing?,
Graham Percival <=
- Re: Macro pre-processing?, Han-Wen Nienhuys, 2006/05/02
- Re: Macro pre-processing?, Mats Bengtsson, 2006/05/02
- Re: Macro pre-processing?, Mats Bengtsson, 2006/05/02
- Re: Macro pre-processing?, Aaron VonderHaar, 2006/05/03
- Re: Macro pre-processing?, Graham Percival, 2006/05/03
- Re: Macro pre-processing?, Rick Hansen (aka RickH), 2006/05/02
- Re: Macro pre-processing?, Erik Sandberg, 2006/05/02
- Re: Macro pre-processing?, Rick Hansen (aka RickH), 2006/05/02
- Re: Macro pre-processing?, David Feuer, 2006/05/02
- Re: Macro pre-processing?, Werner LEMBERG, 2006/05/02