No tempFile() in std.file

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 16 04:19:14 PDT 2017


On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote:
> I suppose that we could add a tempFile that did what 
> std.stdio.File.scratchFile did but create an empty file and 
> return its path rather than returning a File, though that would 
> be a bit annoying, since you'd then have to open it to operate 
> on it instead of just writing to it. Maybe it would be worth 
> doing though given the stupidity blocking 
> std.stdio.File.scratchFile.

That seems perfectly reasonable to me. Couldn't the function 
return both the path and the file in a struct? This is something 
that really should be in Phobos. It's one of those little things 
that makes D a lot less pleasurable to work with, at least for 
anyone needing that functionality.



More information about the Digitalmars-d-learn mailing list