re: issue #2.
I agree with Mr. Feeley that the closure-api is very limiting and makes
finding guardian operations in code challenging because there are lots of
ways to create procedure calls, but api-names are easier to spot.

For my own testing until these questions are resolved, I used:

(guardian-register g obj [rep ob>])
(guardian-next g [default #f])  <-- pop the next triggered rep, or return
default if none are available
(guardian-all g) <-- pops the whole list directly from the tconc without
re-consing

and I also played with guardian-try-collect (which I named guardian-force)
and guardian-wait for proof of concept.  I agree that guardian-wait may not
be especially useful since it is limited to one guardian per thread.   The
"right" design for a system to automatically process guardian triggers may
not be the same for every implementation and I agree these ideas should be
deferred to a future SRFI.


On Tue, Dec 19, 2023 at 3:02 PM John Cowan <[email protected]> wrote:

> There are two remaining guardian issues:
>
> 1) We have two proposals for async operations, Marc F.'s guardian-wait <
> https://srfi-email.schemers.org/srfi-246/msg/23507606/> and Daphne's
> guardian-try-collect <
> https://srfi-email.schemers.org/srfi-246/msg/23847614/>.  It's unclear if
> these are completely distinct.  Here are the apparent differences:
>
> a) -wait suspends the calling thread until there is an object in the
> inaccessible objects group; -try-collect triggers a GC to start with.  The
> latter is useful if the GC is not running in its own thread (e.g. there are
> no threads).
>
> b) If the accessible objects group is empty, guardian-wait apparently
> waits for an object to be registered (adding it to the accessible objects
> group) and then waits again for it to move to the inaccessible objects
> group; guardian-try-collect returns at once.
>
> 2) The other issue is less significant and is orthogonal to 1.  In the
> Chez and Guile implementations, a guardian is a procedure called with one
> or two arguments to add an object to the accessible objects group or with
> zero arguments to remove an object from the inaccessible objects group and
> return its representative.  In Feeley's proposal, these operations are
> procedures applied to opaque guardian objects.  In either case, -unregister
> and -wait/-try-collect are procedures applied to guardian objects.  It is
> easy to convert either style to the other.  The Chez/Guile style is
> backward compatible; the Feeley style is uniform.
>
> Daphne is off-line until next year.  Marc, I haven't heard back from you
> on Daphne's proposal.  Can you weigh in?  Thanks.
>

Reply via email to