Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-08-22 Thread Andrew Tropin
On 2023-06-19 16:20, Andrew Tropin wrote: > * module/ice-9/atomic.scm (atomic-box-update!): New variable. > --- > I was implementing some concurrent code and started to use (ice-9 > atomic), when found out that there is no procedure for updating the > value of the atom using another function. > >

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-07-12 Thread Andrew Tropin
On 2023-06-22 17:42, Philip McGrath wrote: > On Thu, Jun 22, 2023, at 5:02 AM, Andrew Tropin wrote: >> On 2023-06-22 01:21, Philip McGrath wrote: >>> >>> In any case, the current documentation for >>> atomic-box-compare-and-swap! is clear that the comparison is eq?: it >>> just means that, when th

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-22 Thread Philip McGrath
On Thu, Jun 22, 2023, at 5:02 AM, Andrew Tropin wrote: > On 2023-06-22 01:21, Philip McGrath wrote: >> >> In any case, the current documentation for >> atomic-box-compare-and-swap! is clear that the comparison is eq?: it >> just means that, when the behavior of eq? is unreliable, so is the >> behav

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-22 Thread Andrew Tropin
On 2023-06-22 01:21, Philip McGrath wrote: > On Wed, Jun 21, 2023, at 11:59 PM, Andrew Tropin wrote: >> On 2023-06-21 18:54, Jean Abou Samra wrote: >> Le 21 juin 2023 à 18:46, Andrew Tropin a écrit : Make sense, but it's hard for me to say something valuable on this topic. U

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Philip McGrath
On Wed, Jun 21, 2023, at 11:59 PM, Andrew Tropin wrote: > On 2023-06-21 18:54, Jean Abou Samra wrote: > >>> Le 21 juin 2023 à 18:46, Andrew Tropin 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 knowle

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Andrew Tropin
On 2023-06-21 18:54, Jean Abou Samra wrote: >> Le 21 juin 2023 à 18:46, Andrew Tropin 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 whet

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Jean Abou Samra
> Le 21 juin 2023 à 18:46, Andrew Tropin 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 bitwis

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Andrew Tropin
On 2023-06-21 11:06, Jean Abou Samra wrote: > Le mercredi 21 juin 2023 à 11:06 +0200, Jean Abou Samra a écrit : >> Le lundi 19 juin 2023 à 16:20 +0400, Andrew Tropin a écrit : >> > +  (if (eq? old-value (atomic-box-compare-and-swap! box old-value >> > new-value)) >> >> >> Are you sure eq? i

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Jean Abou Samra
Le mercredi 21 juin 2023 à 11:06 +0200, Jean Abou Samra a écrit : > Le lundi 19 juin 2023 à 16:20 +0400, Andrew Tropin a écrit : > > +  (if (eq? old-value (atomic-box-compare-and-swap! box old-value > > new-value)) > > > Are you sure eq? is a good idea here? (eq? 5 5) is unspecified, for exa

Re: [PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-21 Thread Jean Abou Samra
Le lundi 19 juin 2023 à 16:20 +0400, Andrew Tropin a écrit : > +  (if (eq? old-value (atomic-box-compare-and-swap! box old-value > new-value)) Are you sure eq? is a good idea here? (eq? 5 5) is unspecified, for example. Perhaps eqv? would be more appropriate. signature.asc Description: Th

[PATCH] Add atomic-box-update! function to (ice-9 atomic)

2023-06-19 Thread Andrew Tropin
* module/ice-9/atomic.scm (atomic-box-update!): New variable. --- I was implementing some concurrent code and started to use (ice-9 atomic), when found out that there is no procedure for updating the value of the atom using another function. IMHO, atomic-box-update! fits well FP paradigm (which i