D-Programming-Language/phobos — pull request #2233 by rbanderton (2014-06-06 21:19:41+00:00)
Title: Fix Issue 6644 - std.stdio write/writef(ln) are not @trusted

https://issues.dlang.org/show_bug.cgi?id=6644
More discussion here: http://stackoverflow.com/questions/19101305/how-can-i-do-i-o-in-safe-functions-in-d

Changes I have made to get `write` and family callable from `@safe` code:
- Made `LockingTextWriter` and factory function `@trusted` - I didn't see anything inherently unsafe about the way it manages the lock. I'm certainly open to correction, though.
- Wrapped the `stdout` global variable's usage in a `private @trusted` property that is used by `write` and friends. If this is not done they always infer to `@system` due to accessing a global variable. I'm not 100% sure this is safe to to, but with the property being private all external use of the global will still be `@system`.

This is much like https://github.com/D-Programming-Language/phobos/pull/2230 except it does not use free functions - after more testing I found they worked fine as member functions. This is a separate pull request because I'm terrible at git :/