> I consider it bizarre that the top-level variable `output-filename`
> is only considered in a `\book` block where the paper variable
> `output-suffix` is also set, contrary to `output-suffix`.  Why is
> `output-filename` considered at all?  Where in the code is this
> read?  AFAIK, top-level variables are read with `ly:parser-lookup`,
> and I can't find this for `output-filename`.
>
> Or is this an inheritance thing?  Does a `\book` block inherit all
> top-level expressions and convert them to paper variables?

Some debugging shows it seems to be the latter: All top-level
definitions are available as paper variables within a book's paper
block, together with all paper variables of the top-level paper block:
Executing

```
foo = "FOO"

\paper {
  bar = "BAR"
}

\book {
  #(ly:message "paper variable 'foo': ~a\n"
    (paper-variable $current-book 'foo))
  #(ly:message "paper variable 'bar': ~a\n"
    (paper-variable $current-book 'bar))
  { c' }
}
```

yields

```
paper variable 'foo': FOO
paper variable 'bar': BAR
```

Is this really intentional?


    Werner

Reply via email to