-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Unix.setenv and Unix.unsetenv #9810
Conversation
In |
C doesn't exactly have optional arguments (though I take the point that the Unix functions tend to correlate with the underlying function, then counter that with the fact All that said, I don't have a strong opinion... |
Another option would be to drop it. |
A general design principle for the Unix library: when popular C standard libraries expose different ways to do the same thing, we expose only one function in unix.mli and choose between the various available C implementations in the C stubs. See for example So, we will definitely not expose both What is the problem with If you're curious why |
The problem is that we have the API of
I don't mind putting the corrections in
Really? You committed the version in unix 11 days before it was added to win32unix 😉 |
Some one was asking about Is there any concern about adding only As anecdotal evidence, recently I had to write some ad-hoc binding of |
As part of something on ocamltest, I thought I was going to need
Unix.unsetenv
and added it. It turns out I didn't need it there, but it's useful. It also rang a bell that it was discussed in #9594, so here aresetenv
andunsetenv
for discussion, as I happened to have written them.I haven't at this stage reimplemented
putenv
in terms ofsetenv
. Given their strange potted history, I'd be more for keeping bothputenv
andsetenv
(and possibly markingputenv
as deprecated, given how rubbish it is?).The Windows CRT doesn't expose
setenv
or haveunsetenv
, but I provide what I believe are correct implementations of the POSIX spec in terms ofputenv
.