Closed mvdan closed 6 years ago
I like the write.File suggestion the most thus far. I’ll keep this open in case other people have suggestions, too, and then we can eventually pick a winner.
If there are going to be no other PendingFile
constructors, I agree it's the best option.
Given the new package name (and with the hypothetical WriteFile from issue #3 being the new preferred entry point), do you still see a need to change the name? I think renameio.TempFile sounds reasonable.
It's less of a problem - it no longer reads "write temp file". Now it just reads "temp file", which is more ambiguous. So I don't think it gets closer to what the API actually does, but at least it doesn't imply something completely different.
Assuming we can't come up with a better name, renameio.TempFile
sounds okay.
Closing this as #3 is now resolved, and we agreed that the current name is good enough.
Moved from Twitter at https://twitter.com/mvdan_/status/1057290763254546434
I'm not a big fan of code like:
Reading it for the first time, it seems to say "write a temporary file called foo", similar to how
ioutil.TempFile
creates a temporary file named after a string.I think the name should convey "write a file called foo". If there's only going to be this implementation through a temporary file, then I'd just call it
write.File
.If there are going to be other
PendingFile
constructors, I do understand the need to add something to this one's name. Some ideas that come to mind arewrite.WithTemp
,write.ViaTemp
,write.TempTo
, or evenwrite.NewTemp
, since the constructor doesn't actually write anything.