[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ question on wrapper API for setting Guile fluids
From: |
David Kastrup |
Subject: |
Re: C++ question on wrapper API for setting Guile fluids |
Date: |
Thu, 21 Apr 2022 12:58:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Jean Abou Samra <jean@abou-samra.fr> writes:
> Le 21/04/2022 à 10:38, Han-Wen Nienhuys a écrit :
>> On Thu, Apr 21, 2022 at 12:04 AM Jean Abou Samra <jean@abou-samra.fr> wrote:
>>> I am working on code that pervasively utilizes Guile fluids. They should
>>> be set in dynamic scopes.
>> That sounds scary. Care to tell more?
>
> What is scary about it exactly?
>
> I am trying to reimplement purity in terms of fluids, so the set of
> parameters is not hardcoded to 'start, end' and all the code doesn't
> have to be littered with functions working both as pure and impure and
> forwarding start/end to the property callbacks they
> cause.
Good.
> Essentially, this should look like { Dynwind_context dwc;
> dwc->make_assumption (Lily::prebreak_estimate, SCM_BOOL_T);
> ... get_property (grob, "property") ... } or in Scheme:
> (under-assumptions ((*prebreak-estimate* #t)) ...) and by virtue of
> the dynamic context, the callback that computes the grob property
> understands that it should do pure estimates.
My personal take on this would move the magic out of the normal reach of
users. You get (*start-column*) and (*end-column*) which you can use
for accessing the respective fluids but the function *start-column* does
not merely access %start-column but it also registers the associated
impurity for the sake of caching.
This also helps by not registering impurities that don't arise for a
particular grob (things like breakpoint-depending accidentals
comparatively rarely rise to the level of actual relevance but get
everything dealt with as impure, with the associated costs, all the
time).
> I haven't gotten as far as a working proof of concept, but I expect a
> speedup. This is essentially a remix of an idea from David:
> https://lists.gnu.org/archive/html/lilypond-devel/2015-05/msg00397.html
I probably repeat myself...
--
David Kastrup
- Re: C++ question on wrapper API for setting Guile fluids, (continued)
Re: C++ question on wrapper API for setting Guile fluids, Han-Wen Nienhuys, 2022/04/21
Re: C++ question on wrapper API for setting Guile fluids,
David Kastrup <=
Re: C++ question on wrapper API for setting Guile fluids, Jean Abou Samra, 2022/04/21
Re: C++ question on wrapper API for setting Guile fluids, David Kastrup, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Jean Abou Samra, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, David Kastrup, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Jean Abou Samra, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Dan Eble, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Jean Abou Samra, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, David Kastrup, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Jean Abou Samra, 2022/04/21
- Re: C++ question on wrapper API for setting Guile fluids, Luca Fascione, 2022/04/22