Is memory-safe IO possible?

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 22 09:10:26 PST 2016


On Fri, 22 Jan 2016 08:36:14 +0000, Kagamin wrote:

> Should be possible. Why not?

Because almost no IO routines in Phobos are marked @safe, which implies 
that it's difficult in practice or that people simply haven't done it. I 
checked std.file, std.net.curl, and std.stdio; a handful of things are 
@safe while the vast majority aren't.

I want everything I do to be @safe. Unfortunately, "everything I do" 
includes IO (and std.json), and while it's not sprinkled throughout my 
code, the call stack has enough variety that I can't mark very much @safe 
at the end of the day.

At the very least, it would be nice to say: I can't entirely trust some 
of the code I'm calling, but at least for the code I'm writing here, stop 
me from doing anything stupid. A @tryToBeSafeIsh, if you will.


More information about the Digitalmars-d-learn mailing list