[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)
From: |
Jean Abou Samra |
Subject: |
Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic) |
Date: |
Wed, 21 Jun 2023 18:54:57 +0200 |
> Le 21 juin 2023 à 18:46, Andrew Tropin <andrew@trop.in> a écrit :
>
> Make sense, but it's hard for me to say something valuable on this
> topic. Usually, I don't use eq? and don't have enough knowledge of its
> internals.
*Currently*, it just checks whether the two C-level SCM values are the same
bitwise, so even implicit copies of fixnums will remain eq?. In theory, Guile
could make copies of bignums. I am not aware of it doing so.
However, all that is guaranteed is that (eq? a a) when a is a non-immediate
(pair, string, vector, hashtable, etc) or one of a few constants like booleans,
the empty list and *unspecified*. Notably, it isn't guaranteed for numbers or
characters.
> I went the way suggested by the manual: "Returns the
> previous value of the box in either case, so you can know if the swap
> worked by checking if the return value is eq? to expected."
>
> https://www.gnu.org/software/guile/manual/html_node/Atomics.html
As long as you use boxes for values for which eq? is well-defined, that is
fine. I guess this would cover most cases, although I'm not familiar with this
module.
But in general, eqv? seems saner.
- [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/19
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Jean Abou Samra, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Jean Abou Samra, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic),
Jean Abou Samra <=
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/21
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Philip McGrath, 2023/06/22
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Andrew Tropin, 2023/06/22
- Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic), Philip McGrath, 2023/06/22