On 03-04-16 22:56, David Kastrup wrote:
Bernard <lilyp...@bernardhulsman.nl> writes:
Hi Paul,
That does help. I found out \with is a very special statement.
Not really. \with can be part of other constructs, just like "else" can
be part of other constructs in many programming languages (including
Scheme). It is not a "statement" at all.
That does help a lot. Now I understand why there can not be anything
before /with.
It influence what happens before the statement, it must be executed
just after \new . That is the reason why my examples 4 and 5 did not
work.
And it influence what happens after the statement. If within the Staff
not a additional Staff property can be set.
No wonder it confuses me.
\with introduces "context modifications". They are basic expressions in
that they can be stored in variables and passed to functions, but to
take effect, they need to be applied to an actually created context, and
there are various syntactic constructs for doing that.
They "influence what happens after the statement" like any modification
to anything. Their influence is restricted to contexts they are applied
to (possibly via layout or context definitions or wrapped into other
context modifications).
I still do not get it all. By the way, I am my self a Python programmer
and object orientation in known to me.
The example of Thomas Morly with his house with rooms is all in line
with object orientation and setting values of properties.
But still I am missing something.
I have attached some more real live code using /with and and example I
tried to skip the /with section and assign properties directly, which fails.
Thanks very much for all your good work.
With regards,
Bernard
\version "2.18.2"
#(define djembe '(
(dbass default #f -2)
(dbassmute default "stopped" -2)
(dbassopen default "open" -2)
(dopen default #f 0)
(dopenmute default "stopped" 0)
(dopenopen default "open" 0)
(dslap default #f 2)
(dslapmute default "stopped" 2)
(dslapopen default "open" 2)
(sidestick cross #f -4)))
% no abbrevation for the open variant, it is hardly used
drumPitchNames.dbass = #'dbass
drumPitchNames.dba = #'dbass % db seems to be in use
drumPitchNames.dbassmute = #'dbassmute
drumPitchNames.dbm = #'dbassmute
drumPitchNames.dbassopen = #'dbassopen
drumPitchNames.dopen = #'dopen
drumPitchNames.do = #'dopen
drumPitchNames.dopenmute = #'dopenmute
drumPitchNames.dom = #'dopenmute
drumPitchNames.dopenopen = #'dopenopen
drumPitchNames.dslap = #'dslap
drumPitchNames.ds = #'dslap
drumPitchNames.dslapmute = #'dslapmute
drumPitchNames.dsm = #'dslapmute
drumPitchNames.dslapopen = #'dslapopen
% assign to full name, assign to abbrevation does not work.
midiDrumPitches.dbass = g
midiDrumPitches.dopen = a
midiDrumPitches.dslap = b
midiDrumPitches.dbassmute = fis
midiDrumPitches.dopenmute = gis
midiDrumPitches.dslapmute = ais
djEen = \drummode { dba4 do }
% with with section of context
% Line count and instrumentname correct processed
\markup { with section }
\score {
\new DrumStaff
\with {
\override StaffSymbol.line-count = #3
instrumentName = #"Djembe 1"
drumStyleTable = #(alist->hash-table djembe)
}
\djEen
}
\markup { without the use of the with section }
% generate error
\score {
\new DrumStaff {
\override DrumStaff.StaffSymbol.line-count = #3
DrumStaff.instrumentName = #"Djembe 2"
DrumStaff.drumStyleTable = #(alist->hash-table djembe)
}
\djEen
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user