[racket] open-output-file #:exist

From: Marijn (hkBst at gentoo.org)
Date: Wed Aug 24 09:01:38 EDT 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

In the reference in section 12.1.5 File Ports[1], open-output-file is
defined as having an optional keyword argument #:exist which can have
one of 8 different values. The same options are used for a number of
wrapper functions, among which with-output-to-file[2].
If you go to [2] you need to follow 3 internal links to similar
functions to get to open-output-file[1] to find out what the different
values of the #:exists argument mean. I think it would be good if a link
was inserted such that you can go straight there.
Unfortunately I find some of the explanations not so clear. I will
comment on the explanation of each option in the order they appear in
the docs.
1) error: this one is clear
2) replace: how is this different from 3) truncate?
3) truncate: see 2)
4) must-truncate: what about must-replace?
5) truncate/replace: clear if 2) and 3) are clarified
6) update: what is the current read/write position (this is hinted at in
8), but should really be explained fully here) and what happens when you
write to the file (does it overwrite, insert, either depending on some
other option)?
7) can-update: clear if 6) clarified
8) append: why is it only equivalent to update on Windows?

Marijn


[1]:http://docs.racket-lang.org/reference/file-ports.html?#%28def._%28%28lib._racket/private/base..rkt%29._open-output-file%29%29
[2]:http://docs.racket-lang.org/reference/file-ports.html?#%28def._%28%28lib._racket/private/base..rkt%29._with-output-to-file%29%29
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5U9jIACgkQp/VmCx0OL2wy8ACbBPOVfHYF53NTCkY/9qXnbeyP
AIAAn3J0URrJsIIZZiVIh/EOGqOBBJrX
=rLk7
-----END PGP SIGNATURE-----


Posted on the users mailing list.