[m-rev.] for review: private_builtin should not import io, part 1

Julien Fischer jfischer at opturion.com
Mon Dec 8 10:31:13 AEDT 2014



On Sun, 7 Dec 2014, Zoltan Somogyi wrote:

> Step 1 of moving trace_*_io_state out of private_builtin.m.
> 
> At the moment private_builtin.m imports the io module. This is undesirable,
> since private_builtin should not depend on any other module. The import
> is needed only for trace_{get,set}_io_state, predicates that are used
> in the implementation of trace [io(!IO)] scopes to create and destroy
> dummy I/O states.
> 
> The obvious thing to do to remove this undesirable dependency is to move
> those predicates to another module, and the io module is the obvious choice.
> Since these two predicate can also be used to implement Mercury's version
> of Haskell's unsafe_perform_io, give the moved versions names that reflect
> this, unsafe_{get,set}_io_state.
> 
> However, since private_builtin.trace_{get,set}_io_state are builtins,
> moving them requires several steps.
> 
> The first step is making io.unsafe{get,set}_io_state builtins, with definitions
> identical to private_builtin.trace_{get,set}_io_state.
> 
> The second step, once the first step has been installed on all developers'
> machines, is to add declarations for io.unsafe{get,set}_io_state to io.m
> (but not definitions, since these should not be there for builtins), and
> to get the compiler to generate references to these instead of to
> private_builtin.trace_{get,set}_io_state.
> 
> The third step, once the second step has been similarly installed, will be
> to remove the declarations of private_builtin.trace_{get,set}_io_state,
> and to remove the undesirable import.

That's fine.

Cheers,
Julien.



More information about the reviews mailing list