[m-rev.] for reviews: file streams as typeclasss instances

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Oct 4 16:13:16 AEST 2006


On Wed, 4 Oct 2006, Ian MacLarty wrote:

> On Tue, Oct 03, 2006 at 04:24:06PM +1000, Julien Fischer wrote:
>> For review by Ian.
>>
> ...
>> This change is complicated by the fact that the io module interacts
>> with both the runtime and the debugger via the C interface.  In order to
>> preserve the existing C interface that the io module presents to the runtime
>> (the alternative being to more or less to change all the types of the
>
> delete the second "to"

Fixed.

>> runtime/mercury_library_types.h:
>> 	Add macros to wrap (and in once case unwrap) file stream types
>
> s/once/one/

Fixed.

>> Index: library/io.m
>> ===================================================================
>>
>> +    % The following typeclass and instances are required for the
>> +    % deprecated predicates io.seek_binary/5 io.binary_stream_offset/4 to
>> work.
>> +    % They will deleted when those predicate are.
>
> They will *be* deleted...

Fixed.

> Otherwise that looks fabulous.

Actually, there was one small problem that broke one of the declarative
debugger's test cases.  The change to the io module in the following 
interdiff addresses that point.  I've also added an entry to the NEWS 
file for this change.

diff -u library/io.m library/io.m
--- library/io.m	3 Oct 2006 03:59:56 -0000
+++ library/io.m	4 Oct 2006 05:56:37 -0000
@@ -919,7 +919,7 @@

      % The following typeclass and instances are required for the
      % deprecated predicates io.seek_binary/5 io.binary_stream_offset/4 to work.
-    % They will deleted when those predicate are.
+    % They will be deleted when those predicate are.
      %
  :- typeclass io.binary_stream(T).
  :- instance  io.binary_stream(io.binary_input_stream).
@@ -3988,6 +3988,8 @@
          io.write_stream(NonCanon, Stream, Priority, !IO)
      ; univ_to_type(Univ, binary_output_stream(Stream)) ->
          io.write_stream(NonCanon, Stream, Priority, !IO)
+    ; univ_to_type(Univ, Stream) ->
+        io.write_stream(NonCanon, Stream, Priority, !IO)
      ; univ_to_type(Univ, C_Pointer) ->
          io.write_c_pointer(C_Pointer, !IO)
      ;
only in patch2:
unchanged:
--- NEWS	25 Sep 2006 02:44:17 -0000	1.425
+++ NEWS	4 Oct 2006 06:07:05 -0000
@@ -84,6 +84,13 @@
    This makes it easier to diagnose mode errors caused by insts that are not
    consistent with the type they are intended to be consistent with.

+Changes to the Mercury standard library:
+
+* The predicates io.seek_binary/5 and io.binary_stream_offset/4 have been
+  deprecated.  They have been replaced by the predicates:
+  io.seek_binary_input/5, io.seek_binary_output/5,
+  io.binary_input_stream_offset/4 and io.binary_output_stream_offset/4.
+

  NEWS for Mercury 0.13
  ---------------------
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list