10.13.4 Where purity is used

Pure Y values must be used in any functions that are called before line breaking. Examples of this can be seen in Separation_items::boxes to construct horizontal skylines and in Note_spacing::stem_dir_correction to correct for optical illusions in spacing. Pure properties are also used in the calculation of other pure properties. For example, the Axis_group_interface has pure functions that look up other pure functions.

Purity is also implicitly used in any functions that should only ever return pure values. For example, extra-spacing-height is only ever used before line-breaking and thus should never use values that would only be available after line breaking. In this case, there is no need to create callbacks with pure equivalents because these functions, by design, need to be pure.

To know if a property will be called before and/or after line-breaking is sometimes tricky and can, like all things in coding, be found by using a debugger and/or adding printf statements to see where they are called in various circumstances.

LilyPond — Contributor’s Guide v2.17.97 (development-branch).