[m-rev.] for review: delete see/seen/tell/told from io.m

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Mar 5 19:14:36 AEDT 2022


2022-03-05 18:51 GMT+11:00 "Julien Fischer" <jfischer at opturion.com>:
>> The thing is that io.write_list is quite different from other output predicates,
>> because its main job is not writing out the list (list.foldl(io.write) on the list
>> will do that just fine), but managing what goes *between* the elements.
> 
> Its behaviour is similar io.write_array, which according to the above
> *is* being moved.

I didn't know that; I don't think I have ever used write_array.

But since the task is similar to write_list, the solution can be too:
a version of array.foldl that takes an update to apply to the accumulator
between elements.
 
> Updating a mutable's value may well be atomic, however update_globals/3
> does a bit more.  Specifically, it does the following:
> 
>     1. Gets the current value in the globals.
>     2. Applies a closure that transforms it in some way.
>     3. Sets the value of the globals to the transformed value.
> 
> All of that is supposed to be atomic; AFAIK nothing in the currently
> documented mutable implementation allows for that.

Right, though the above three steps would not be hard to put
into the body of an automatically generated clause. Putting lock
and unlock operations around it would not be too hard either,
even including the definition of the lock var. The most error-prone
part would be programming the exception handling required
to recover from an update predicate that throws an exception.

Zoltan.


More information about the reviews mailing list