[m-rev.] for review: add string.line type

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Apr 19 13:36:16 AEST 2007


On Thu, 19 Apr 2007, Jonathan Morgan wrote:

>> +    % This type is used for defining stream typeclass instances where the 
>> raw
>> +    % string type would be ambiguous.
>> +    %
>> +:- type line
>> +    --->    line(string).
>> +
>
> I don't think that this comment is sufficient.  I would like a
> definition of what the term `line' actually means in this context.
> For example, a line may contain the end-of-line character, or it may
> not.  I have seen the term used both ways (and, as you already know
> that the end-of-line character must have occurred at the end of the
> string containing the line, I would argue that preserving it is not
> necessary when you are using the line type).  This isn't documented in
> io.read_line_as_string either.
>

Note that io.read_line (which reads a list of chars) includes the newline.
All of these predicates should be consistent w.r.t their newline 
behaviour.

Also, it seems as though some renaming is probably in order.  To me
io.read_line should read a line not a char list, the existing one
should be renamed io.read_line_as_char_list.


Julien.





--------------------------------------------------------------------------
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