[Prev][Next][Index][Thread]
Re: Is anyone there?
In article <8rl0ph$i1v$1@nnrp1.deja.com>, johncwhi@my-deja.com wrote:
> This group seems a little moribund lately :((, and I don't seem to be
> getting anything from info-dylan.
There's lots of activity on the Gwydion Dylan mailing lists at present.
We're busy debating the best way to support text vs binary files on
Cygwin. And other stuff.
Perhaps we could do with some input from Fun-O users.
At present, d2c is Unix-centric and expects to read and write 0x0A as
newline. It leaves stdin, stdout, stderr the way it finds them (which
the C standard says is text mode, where it makes a difference) and so
automagically inherits [1] any newline translation done by the
underlying C runtime and/or OS. And so things Just Work, for
stdin/stdout/stderr at least, on all platforms including Mac and
Windows. Other streams opened by the programmer are more problematic
and we would appear to need to add a text/binary keyword argument to
make(<fd-stream>) for generality. Which is where we run into
compatability problems, because...
... the documentation at Fun-O says, in contrast, that all files are
opened in binary mode, and that any line end conversion is done only by
the read-line and write-line/new-line functions:
<http://www.fun-o.com/products/doc/io/io_59.htm#HEADING59-0>
This means that "\n" in string literals doesn't do anything useful,
contrary to large amounts of existing Gywdion source code. It also
means that if you write things to a <string-stream> and then write out
the contents of the <string-stream> then you won't get any endline
conversion at all. Which is bad.
It doesn't appear to be documented, but I'm told that Fun-O's format()
function actually *does* check for embedded \n's in the format string
(and in any interpolated data strings??) and calls (the
platform-specific) new-line() instead of simply writing those characters.
Which means that if you use write() then you never get endline
conversion, but if you call format() on the exact same stream then you
*do8 gt newline conversion.
If true, I certainly applaud this because I don't see any future at
*all* in gratuitously annoying millions of C/C++/Java/Perl programmers
(hypothetically trying out Dylan at some point) by forcing them to call
new-line() every time instead of just putting a "\n" in their strings as
they are used to doing. Hell, that's probably one of the stupidities
that killed Pascal and Modula-2. The C way is unclean, but it works and
millions of people expect it.
-- Bruce
[1] as long as we don't do dumb things such as explicitly put those
files into binary mode in out init code.
References: