Missing a write("file.txt",mynumber, "a") shortcut

I know that I can open/close a file and print on it, but sometime I find convenient to use write, especially when the time for opening/closing the stream is irrelevant.

I miss a version of write where I can specify to append instead of overwrite the whole file :-/

It’s already rather short:

open(io -> write(io, mystring), "file.txt", "a")

nice.. but it’s still rather conceptually dense… a function that takes the first input another function, we use an anonymous function that operate on a stream… that’s absolutely fine, but I still think that for people that “incidentally” have to use a programming language to get something out of their data, something like write("file.txt",mystring,"a") would be simpler, without exposing the concept of stream entirely..

Sorry, I always take the point of view of “dump guys” here (largely because I am myself part of that set :slight_smile: :slight_smile: ), but I still think it’s important to consider them too :slight_smile: :slight_smile: …

Agreed. Maybe Julia’s designers kept append behind open so that dummies like us don’t grow a file by accident. Erasing one is apparently fine. :wink: