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

Peter Wang wangp at students.csse.unimelb.edu.au
Thu Apr 19 14:01:18 AEST 2007


On 2007-04-19, Jonathan Morgan <jonmmorgan at gmail.com> 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.

How about:

    % A line is:
    %
    % - a possibly empty sequence of non-newline characters terminated by a
    %   newline character; or
    % - a non-empty sequence of non-newline characters terminated by the end
    %   of the file.

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

The problem with that is you can't tell if a "line" at the end of a file
was terminated with a newline or not.

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