lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting context-definiton, while being in applyContext


From: David Kastrup
Subject: Re: Getting context-definiton, while being in applyContext
Date: Sun, 18 Nov 2018 21:15:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> Am So., 18. Nov. 2018 um 20:40 Uhr schrieb David Kastrup <address@hidden>:
>
>> Just do
>>
>> (eq? ctx (ly:context-find ctx 'Staff))
>>
>> --
>> David Kastrup
>
> I did not even consider to use ly:context-find. The description says:
> Find a _parent_ of context that has name or alias name. Return #f if not 
> found.
> So I expected it could return
> Staff as parent of Voice
> StaffGroup as parent of Staff
> Score as parent of StaffGroup
>
> Similar to
> Function: ly:context-parent context
>     Return the parent of context, #f if none.
> Although this one returns a tree of contexts not even a single parent.
> At least for me this was a surprise.
>
> Is my understanding of parents with contexts entirely wrong ...?

Probably not.  I remembered that the function was there.  I read the doc
string and said "huh?".  I read the C++ code and said "WTF?".  And then
I pretended that this was totally obvious to make me look smart.  In my
defense, I did not write that doc string (at least I hope so).

"Find a parent" does not make a lot of sense considering that each
context has at most one parent.

It's more like "Find among the chain of successive direct parents
starting with the context itself".

Some of our doc strings are not particularly helpful.  At least the
function itself is.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]