If I type ?write the the REPL, I can see a second method write(filename::AbstractString, content). Is this intentionally left out of the manual and discouraged? Should I prefer
open("/path/to/file", "w") do io
print(io, some_string)
end
over the alternative, write("/path/to/file", some_string)? I’m asking because I’ve always been using the first version, and I wasn’t aware of the second version until I encountered it in an unrelated post.
I don’t know about the thinking in the manual but personally I find the ergonomics of the filename method so superior that I always use it when it’s applicable.
Just to add that it is common in many packages to provide both a IO argument or a string one that if used refer to a file path to interact with (and open it’s relative stream)…