[m-dev.] Porposal: Support reading/writing either dos/unix file endings on any platform

Julien Fischer jfischer at opturion.com
Tue Nov 12 14:55:36 AEDT 2013


On Tue, Nov 12, 2013 at 12:06 PM, Paul Bone <paul at bone.id.au> wrote:

>
> io.open_input/4 and io.open_output/4 open files for text input.  This means
> that line endings are automatically translated between platforms.  If a
> UNIX-style OS is used the file is assumed to be in the UNIX format, if a
> DOS-style OS is used then the file is assumed to be in the DOS format.
> However these assumptions aren't always correct.
>
> I share files with developers who use Windows (while I use Linux).  If a
> Mercury program such as the error program opens a file created by a
> developer who uses windows, then it incorrectly assumes the file uses the
> UNIX file endings, and after modifying and saving the file it uses a mix of
> both endings.
>
> Rather than awkwardly patch the error program, every other program that
> should behave like this,


Look at the author list of that program, I'm guessing that Windows support
wasn't really a consideration ;-)


> it'd be better to add support for this in Mercury's
> standard library.


I'm not convinced that this is a useful addition.

What actually happens now for each target language / OS combination?

I propose that:
>
>     + An input stream's line ending style is automatically detected from
> the
>       file's contents, not from the host OS.


I don't want that sort of heuristic approach (even for something as simple
as line
endings) going on behind my back.

Cheers,
Julien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/developers/attachments/20131112/b8c83c6b/attachment.html>


More information about the developers mailing list