A reference type Marc Nieper-Wißkirchen (18 Aug 2022 21:45 UTC)
Re: A reference type John Cowan (19 Aug 2022 01:36 UTC)
Re: A reference type Lassi Kortela (19 Aug 2022 10:03 UTC)
Re: A reference type Marc Nieper-Wißkirchen (19 Aug 2022 10:11 UTC)
Re: A reference type Lassi Kortela (19 Aug 2022 10:25 UTC)
Places in Scheme Marc Nieper-Wißkirchen (19 Aug 2022 10:42 UTC)
Re: Places in Scheme Marc Nieper-Wißkirchen (19 Aug 2022 11:36 UTC)
Re: Places in Scheme Per Bothner (19 Aug 2022 16:33 UTC)
Re: Places in Scheme Marc Nieper-Wißkirchen (19 Aug 2022 17:58 UTC)
Re: Places in Scheme Panicz Maciej Godek (25 Aug 2022 15:20 UTC)
Re: Places in Scheme Ray Dillinger (26 Aug 2022 02:29 UTC)
Re: A reference type Marc Nieper-Wißkirchen (19 Aug 2022 10:54 UTC)
Re: A reference type Marc Nieper-Wißkirchen (19 Aug 2022 11:44 UTC)
Re: A reference type Peter Bex (19 Aug 2022 12:02 UTC)
Re: A reference type Marc Nieper-Wißkirchen (19 Aug 2022 12:26 UTC)
Big words Lassi Kortela (19 Aug 2022 16:29 UTC)
Re: Big words Marc Nieper-Wißkirchen (19 Aug 2022 18:07 UTC)
Re: Big words Lassi Kortela (19 Aug 2022 20:06 UTC)
Re: Big words Marc Nieper-Wißkirchen (19 Aug 2022 20:31 UTC)
Re: Big words blake@xxxxxx (19 Aug 2022 22:06 UTC)
Re: Big words blake@xxxxxx (19 Aug 2022 22:08 UTC)
Re: Big words Arthur A. Gleckler (19 Aug 2022 18:09 UTC)
Re: Big words John Cowan (19 Aug 2022 18:39 UTC)

Re: A reference type Marc Nieper-Wißkirchen 19 Aug 2022 12:26 UTC

Thank you for this reference, Peter. I didn't know about the Chicken
module before.

The only difference seems to be in fact just in `make-locative`. But
this is not problematic because the first argument of my
`make-locative` has to be a procedure, while the first argument of
Chicken's `make-locative` must be a non-procedure.

So an implementation can easily support both versions in one
procedure. More importantly, if one version is mistaken for the other,
it won't go silent.

What I find interesting is Chicken's `(make-weak-locative CONTAINER
INDEX)'. To my proposal, I could add `(make-weak-locative KEY
LOCATIVE)` (again with no problematic clash!) defined through
something like:

(define make-weak-locative
  (lambda (key loc)
    (define eph (make-ephemeron key loc))
    (make-ephemeron-locative eph)))

(define make-ephemeron-locative
  (lambda (eph)
    (define who 'make-ephemeron-locative)
    (define locative
      (lambda ()
        (define loc (ephemeron-datum eph))
        (when (ephemeron-broken? eph)
          (assertion-violation who "location garbage collected" eph))
        loc))
    (make-locative
      (lambda ()
        (location-ref (location)))
      (lambda obj*
        (apply location-set! (location) obj*)))))

Here, I used the procedures of SRFI 124. KEY is a Scheme object that
controls the availability of the locative. A typical use would be

(define vec (vector 1 2 3))
(define weak-loc (make-weak-locative vec (make-vector-locative vec 0)))
(define first (location-ref weak-loc)) ; first <- 1
(reference-barrier vec)
(define second (location-ref weak-loc)) ; may raise an assertion violation

Am Fr., 19. Aug. 2022 um 14:02 Uhr schrieb Peter Bex <xxxxxx@more-magic.net>:
>
> On Fri, Aug 19, 2022 at 12:53:57PM +0200, Marc Nieper-Wißkirchen wrote:
> > Your extensive knowledge is always very helpful, John!
> >
> > So, let us call the objects "locatives" instead.  This also has the
> > advantage that the getter can be reasonably named "locative-ref" as would
> > be custom in Scheme.
>
> Looks like your proposal is quite similar to what we have in CHICKEN.
> I would argue to have a look at our API first, since the proposal has
> some API parts that have the same names as CHICKEN's, but are
> incompatible in their definition.
>
> https://wiki.call-cc.org/man/5/Module%20(chicken%20locative)
>
> From a quick scan, at least make-locative is different.
>
> Cheers,
> Peter