[m-rev.] for review: io.stream_db.m

Julien Fischer jfischer at opturion.com
Fri Mar 11 17:44:47 AEDT 2022


On Fri, 11 Mar 2022, Zoltan Somogyi wrote:

> 2022-03-11 16:14 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:

>>> diff --git a/library/io.m b/library/io.m
>>> index 59da37102..d47279af4 100644
>>> --- a/library/io.m
>>> +++ b/library/io.m
>> 
>>> -
>>> -:- func get_stream_id(stream) = stream_id.
>>> -
>>> -:- pragma foreign_proc("C",
>>> -    get_stream_id(Stream::in) = (Id::out),
>>> -    [will_not_call_mercury, promise_pure, thread_safe,
>>> -        does_not_affect_liveness, no_sharing],
>>> -"
>>> -#ifndef MR_NATIVE_GC
>>> -    // Most of the time, we can just use the pointer to the stream
>>> -    // as a unique identifier.
>>> -    Id = (MR_Word) Stream;
>>> -#else
>>> -    // For accurate GC we embed an ID in the MercuryFile
>>> -    // and retrieve it here.
>>> -    Id = (Stream)->id;
>>> -#endif
>>> -").
>>> -
>>> -:- pragma foreign_proc("C#",
>>> -    get_stream_id(Stream::in) = (Id::out),
>>> -    [will_not_call_mercury, promise_pure],
>>> -"
>>> -    Id = Stream.id;
>>> -").
>>> -
>>> -:- pragma foreign_proc("Java",
>>> -    get_stream_id(Stream::in) = (Id::out),
>>> -    [will_not_call_mercury, promise_pure, may_not_duplicate],
>>> -"
>>> -    Id = Stream.id;
>>> -").
>>> -
>> 
>> I would leave get_stream_id in io.m along with the definitions of the
>> stream type, and other stream_id stuff.
>
> get_stream_id is called only from io.stream_db.m, and nowhere else.
> If the id field of streams had another use besides being the key in the
> stream db, I would agree with you, but it does not.
>
> Julien, would you care to break the tie?

My inclination would be to put them all in io.stream_db.m, if some
of the functionality related to the stream DB is in that submodule
I would expect to find all of it there.

Peter, what's your reason for wanting to keep it in io.m.

Julien.


More information about the reviews mailing list