-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
close #9372 add std/tempfiles #17361
Conversation
Some general things:
|
Does this really have to be a new module? Can't we put it in |
It should be added to |
|
std/tempfille is expected to grow more features and deserves its own modules, std/os is too large already. Modules are a cheap abstraction. But this should be std/tempfiles, not std/tempfile
Note that even python defines it in its own modules (https://docs.python.org/3/library/tempfile.html) |
I only implement the safe one(use |
Is automatic cleanup planned? |
High level API can be implemented in the future PR(by means of destructors) already added to todo |
The PR is ready to be reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after remaining comments
Merging this now, can be further improved later. |
* close nim-lang#9372 add std/tempfile
close #9372 add std/tempfiles
Followup:
destructors
version that does clean-up works automatically.D:
https://dlang.org/library/std/stdio/file.tmpfile.html
Python:
https://docs.python.org/3.7/library/tempfile.html
C++/C:
http://www.cplusplus.com/reference/cstdio/tmpfile
Golang:
https://golang.org/pkg/io/ioutil
Ruby:
https://ruby-doc.org/stdlib-2.5.3/libdoc/tempfile/rdoc/Tempfile.html
PHP:
https://www.php.net/manual/en/function.tmpfile.php
Java/Groovy/Kotlin:
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempFile-java.nio.file.Path-java.lang.String-java.lang.String-java.nio.file.attribute.FileAttribute...-
C#:
https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettempfilename?view=net-5.0
Perl:
https://perldoc.perl.org/File::Temp
Haskell:
http://hackage.haskell.org/package/temporary-1.3/docs/System-IO-Temp.html
Lua:
io.tmpfile()
OCaml:
http://caml.inria.fr/pub/docs/manual-ocaml/libref/Filename.html#VALtemp_file