[Issue 12368] std.file.write conflicts with std.stdio.write
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 15 02:15:39 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12368
Jakob Ovrum <jakobovrum at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jakobovrum at gmail.com
Resolution| |INVALID
--- Comment #2 from Jakob Ovrum <jakobovrum at gmail.com> 2014-03-15 02:15:33 PDT ---
(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.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list