On Dec 14, 2013, at 9:21 AM, Keith OHara <k-ohara5...@oco.net> wrote:

> On Fri, 13 Dec 2013 23:05:49 -0800, David Kastrup <d...@gnu.org> wrote:
> 
>> That does not make sense.  If you want call-once behavior, you can just
>> use a callback.
> 
> At the moment, the decision on whether to preserve the callback pointer in 
> the grob property, or fill the property with the returned value, depends on 
> the method used to request the property, get_pure_property() versus 
> get_property().   A callback would be called multiple times (and it would 
> have to support the unpure-pure calling convention).
> 
> The information of whether the callback is providing a value that /should/ be 
> kept as final is better stored in the Grob itself, so I am thinking of ways 
> to reorganize.
> 

Excellent observation.

Currently, unpure-pure-containers to which one passes one function/argument use 
that function/constant for both the pure and unpure parts.
What you want to do is cache the pure result, not unlike 
Item::cache_pure_height (Interval height) [line 247 of item.cc].  I’m a fan of:
doing caching for more grobs (not just items)
doing caching for more properties (not just heights)
doing conditional caching, meaning caching a result after having finished X or Y

It’d be nice to have a general mechanism for all this.

Cheers,
MS
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to