[m-dev.] more things to move from io.m.

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Mar 14 19:48:53 AEDT 2022


2022-03-14 18:52 GMT+11:00 "Julien Fischer" <jfischer at opturion.com>:
> On Mon, 14 Mar 2022, Zoltan Somogyi wrote:
>> One is the predicates flush_output_2 and flush_binary_output_2.
>> We could move these to either io.stream_ops, io.primitives_write,
>> or to a new submodule that writes out non-primitive items. I think
>> stream_ops is the right place.
> 
> stream_ops seems fine.
> 
>> Another is the implementations of read_word, read_line, read_file
>> and their variants. I think these can be moved to a new submodule
>> (leaving the top-level predicates in io.m); the main question is what this
>> new submodule should be named. These are the only non-primitive things
>> io.m reads that take up any space in io.m itself. Reading terms is done by
>> mercury_term_parser.m; reading bitmaps is now done by bitmap.m.
>> How about io.read_text.m, or io.text_read.m to fit in with io.primitives_read.m?
> 
> io.text_read seems fine.

Will do  both of these.

> Based on a quick grep of the compiler source code:
> 
>     list.foldl 1542
>     list.foldl2 327
>     list.foldl3 76
>     list.foldl4 31
>     list.foldl5 9
>     list.foldl6 2
>     list.foldl7 0
>     list.foldl8 0
>     list.foldl9 0
> 
> (This is counting module qualified calls only, so it is indicative only.)

Ok, I will add them up to arity four.

What should the predicate name be? list.chunk_fold? long_fold?
I have a slight preference for the former, but only as the lesser
of two evils.

The naming scheme should work for map_foldl as well.

> The distribution is similiar for map_foldl. 

>> I also intend to remove from io.m the internal-only with_input_stream
>> predicates, by making their callers use explicit streams.
> 
> No objection from me.

The attached diff contains three separate changes that I am testing
together, each with its own log file. One implements this.
It has bootchecked in asm_fast; the bootcheck in C# has just
started building stage 3. I will bootcheck in Java as well before commit,
but I figured the risk of failure is low enough that I could post the diff for review now.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.rd
Type: application/octet-stream
Size: 286 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20220314/144f18e9/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.mc
Type: application/octet-stream
Size: 864 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20220314/144f18e9/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.mb
Type: application/octet-stream
Size: 174 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20220314/144f18e9/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.mb_mc_rd
Type: application/octet-stream
Size: 15933 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20220314/144f18e9/attachment-0007.obj>


More information about the developers mailing list