lilypond-devel
[Top][All Lists]
Advanced

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

Re: Adds some info about pure properties to the CG. (issue 5364048)


From: joeneeman
Subject: Re: Adds some info about pure properties to the CG. (issue 5364048)
Date: Wed, 16 Nov 2011 01:19:06 +0000


http://codereview.appspot.com/5364048/diff/4001/Documentation/contributor/programming-work.itexi
File Documentation/contributor/programming-work.itexi (right):

http://codereview.appspot.com/5364048/diff/4001/Documentation/contributor/programming-work.itexi#newcode1836
Documentation/contributor/programming-work.itexi:1836: LilyPond).
Purity is not only about returning predictable values. It's also about
not having any side effects.

http://codereview.appspot.com/5364048/diff/4001/Documentation/contributor/programming-work.itexi#newcode1844
Documentation/contributor/programming-work.itexi:1844: meaningful notion
of estimation.  For example, even if a color was
I would argue that the reason for lacking pure estimation for color is
that we haven't found a use for it rather than because of any intrinsic
properties of color.

http://codereview.appspot.com/5364048/diff/4001/Documentation/contributor/programming-work.itexi#newcode1888
Documentation/contributor/programming-work.itexi:1888: taken from the
stencil.
Actually, the requirement is different: the print function must not have
any side effects. The print function doesn't necessarily have to deliver
the same result at all stages in the compilation process. For example,
if some side-effect modifies the font size of a grob mid-compilation,
then note-head::print will deliver a stencil of a different height.

http://codereview.appspot.com/5364048/diff/4001/Documentation/contributor/programming-work.itexi#newcode1901
Documentation/contributor/programming-work.itexi:1901: @end itemize
I think the preceding four lists can be understood as follows: if you
have a Grob and you want to estimate its height, what can you do?

 - If its Y-extent callback is pure, just use it (pure-functions)
 - If its Y-extent callback is ly:grob::stencil-height and the stencil
callback is pure, then it's safe to use ly:grob::stencil-height
(pure-print-functions)
 - If we have a manually-created pure version of its Y-extent callback,
use that (pure-conversions-alist and pure-print-to-height-conversions)

http://codereview.appspot.com/5364048/



reply via email to

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