proposal jobol (06 Nov 2025 05:50 UTC)
Re: proposal Marc Nieper-Wißkirchen (06 Nov 2025 11:43 UTC)
Re: proposal jobol (06 Nov 2025 19:28 UTC)
Re: proposal Marc Nieper-Wißkirchen (06 Nov 2025 21:00 UTC)

Re: proposal Marc Nieper-Wißkirchen 06 Nov 2025 11:43 UTC

Hi José,

Thanks for the suggestion!

If I understand correctly, one would use `ephemeron-get' as follows:

(let-values (((key val) (ephemeron-get x)))
  (if key
      <code that can use VAL because the ephemeron was unbroken>
      <code that handles the broken case and ignores VAL>))

Without `ephemeron-get', this would look like

(let ((val (ephemeron-value x)))
  (if (ephemeron-key x)
      <code using VAL>
      <code ignoring VAL>))

If used in this way, it doesn't seem that `ephemeron-get' saves much
typing. Maybe, I misunderstood.

Marc

Am Do., 6. Nov. 2025 um 06:51 Uhr schrieb jobol <xxxxxx@nonadev.net>:
>
>
> Hi Mark, hi list,
>
> I propose to add the procedure 'ephemeron-get' that take one
> argument, the ephemeron, and that returns 2 values: the key and the
> value. Equivalent to:
>
> (define (ephemeron-get x)
>    (values (ephemeron-key x)(ephemeron-value x)))
>
> If implemented by the compiler/interpreter, it might solve race between
> code and gc, but I'm not sure of that.
>
> Regards
> José