Bug 12368 – std.file.write conflicts with std.stdio.write

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-14T23:00:00Z
Last change time
2016-03-27T18:10:28Z
Keywords
pull
Assigned to
nobody
Creator
dlang-bugzilla
Depends on
13009

Comments

Comment #0 by dlang-bugzilla — 2014-03-14T23:00:19Z
import std.stdio, std.file; string s, fn; write(fn, s); I think there should be a writeFile alias to avoid this conflict.
Comment #1 by dlang-bugzilla — 2014-03-14T23:02:31Z
Comment #2 by jakobovrum — 2014-03-15T02:15:33Z
(In reply to comment #0) > import std.stdio, std.file; > string s, fn; > write(fn, s); > > I think there should be a writeFile alias to avoid this conflict. There's a ton of these in Phobos (another common example is `copy`), and they're not a problem due to how the module system works. Your example is correctly an error. It's up to the user to disambiguate - the user has a ton of options in doing so, including: 1 ---- import std.stdio; static import std.file; string s, fn; write(fn, s); std.file.write(fn, s); ------ 2 ---- import std.stdio; import file = std.file; string s, fn; write(fn, s); file.write(fn, s); ------ 3 ---- import std.stdio : stdoutWrite = write; import std.file : fileWrite = write; string s, fn; stdoutWrite(fn, s); fileWrite(fn, s); ------ 4 ---- import std.stdio; void func() { import std.file; string s, fn; .write(fn, s); write(fn, s); } ----- The list goes on forever. Closing this because this is by design - if you still have a problem with that design, it would need some serious convincing on the NG to warrant any changes.
Comment #3 by github-bugzilla — 2016-03-27T18:10:27Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/99651dc92e6239a44ec4092871042626e6d55613 Merge pull request #2011 from CyberShadow/fix12368 fix Issue 12368 - std.file.write conflicts with std.stdio.write