[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: constructive criticism
From: |
Nicolas Sceaux |
Subject: |
Re: constructive criticism |
Date: |
Wed, 07 Jan 2004 21:41:36 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Wed, 7 Jan 2004 00:09:55 +0100, Han-Wen a dit :
> A similar idea has been on my mind for some time. In LilyPond 2.1 CVS,
> you can now do
> \context Staff \with { StaffSymbol \set #'line-count = #4 } { c4 }
> to get a staff with 4 lines.
> Currently, this only works for new contexts.
Indeed that would be great if \with could be used inside a existing
context:
\context Staff {
BLI
\with { Stem \set #'thickness = #4 }
{ BLA }
BLU
}
> It would be possible to add a hack that translates
> \context Staff \with { Stem \set #'thickness = #4 }
> { BLA }
> to
> \context Staff {
> \property Staff.Stem \override #'thickness = #4
> BLA
> \property Staff.Stem \revert #'thickness
> }
> for existing Staff contexts.
[digression, don't have to be read]
That behaviour reminds me lisp macros.
Ie a special kind of "function" that can take a body of code as
argument, without evaluating it, in order to compute more elaborated
code. Ah, if only lilypond syntax were more lispy... adding such a
feature would be so trivial (in approximative guile scheme):
(defmacro* with-properties (context properties #:rest body)
(let ((prop-vals (group properties 2)))
`(sequential
,@(map (lambda (prop-val)
`(context-property-override ,context
,(car prop-val)
,(cadr prop-val)))
prop-vals)
,@body
,@(map (lambda (prop-val)
`(context-property-revert ,context
,prop-val))
(map car prop-vals)))))
then:
(context Staff
BLI
(with-properties Staff (stem-thickness 4
slur-transparent #t)
BLA)
BLU)
== macro expansion of with-properties ==>
(context Staff
BLI
(sequential
(context-property-override Staff stem-thickness 4)
(context-property-override Staff slur-transparent #t)
BLA
(context-property-revert Staff stem-thickness)
(context-property-revert Staff slur-transparent))
BLU)
nicolas
- Re: constructive criticism, (continued)
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/09
- Re: constructive criticism, François Pinard, 2004/01/08
- Re: constructive criticism, Dave Pawson, 2004/01/09
- Re: constructive criticism, Jeffery B. Rancier, 2004/01/09
- Re: constructive criticism, Dave Pawson, 2004/01/09
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/10
- Re: constructive criticism, Jan Nieuwenhuizen, 2004/01/08
- Re: constructive criticism, Ferenc Wagner, 2004/01/08
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/09
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/07
Re: constructive criticism,
Nicolas Sceaux <=
- Re: constructive criticism, Mats Bengtsson, 2004/01/08
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/08
- Re: constructive criticism, Jan Nieuwenhuizen, 2004/01/08
- Re: constructive criticism, Han-Wen Nienhuys, 2004/01/08
- Re: constructive criticism, Mats Bengtsson, 2004/01/08
\apply nest-props Re: constructive criticism, Nicolas Sceaux, 2004/01/10
Re: constructive criticism, Nicolas Sceaux, 2004/01/09