[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ question on wrapper API for setting Guile fluids
From: |
Han-Wen Nienhuys |
Subject: |
Re: C++ question on wrapper API for setting Guile fluids |
Date: |
Thu, 21 Apr 2022 11:18:25 +0200 |
On Thu, Apr 21, 2022 at 10:53 AM Jean Abou Samra <jean@abou-samra.fr> wrote:
> >> 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 worried about introducing problems associated with dynamic
scoping into the code base; the (un)pure stuff is already there
though, so it probably is not going to create new problems, though.
> 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. 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. The
> property then gets cached if it doesn't depend on assumptions, or if
> it only depends on *prebreak-estimate* (in that case with two cached
> value, prebreak and postbreak), but not if the callback uses
> *prebreak-estimate-start* or *prebreak-estimate-end*. I'll have to
> experiment with caching strategies, but this is the current idea.
OK. I'm curious to see how that turns out. Does every call to
get_property() will have to check the fluid as well to see if it
should cache the computed value?
How does the caching framework know if the computation depends on the
assumption?
--
Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen
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, 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, 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