www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - toString conflic importing std.string & std.date?

reply AEon <aeon2001 lycos.de> writes:
I am presently trying to use th std.date functions to get the current 
system time, but when I add this code

import std.string;
import std.date;				

I get a conflict:

E:\d\dmd\bin\..\src\phobos\std\string.d(2009):
function std.string.toString conf licts with std.date.toString at
E:\d\dmd\bin\..\src\phobos\std\date.d(410)

--- errorlevel 1


Any way to fix this?
Mar 25 2005
parent reply J C Calvarese <jcc7 cox.net> writes:
AEon wrote:
 I am presently trying to use th std.date functions to get the current 
 system time, but when I add this code
 
 import std.string;
 import std.date;               
 
 I get a conflict:
 
 E:\d\dmd\bin\..\src\phobos\std\string.d(2009):
 function std.string.toString conf licts with std.date.toString at
 E:\d\dmd\bin\..\src\phobos\std\date.d(410)
 
 --- errorlevel 1
 
 
 Any way to fix this?
Sure. There are a few ways to approach it. You can alias one of the toString's to make it default like this... import std.string; import std.date; alias std.string.toString toString; Or you can type out std.string.toString or std.date.toString each time you refer to toString to disambiguate it. Here's a brief description of a similar error: http://www.prowiki.org/wiki4d/wiki.cgi?ErrorMessages#ConflictingSymbols -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Mar 25 2005
next sibling parent AEon <aeon2001 lycos.de> writes:
J C Calvarese wrote:
 AEon wrote:
 
 I am presently trying to use th std.date functions to get the current 
 system time, but when I add this code

 import std.string;
 import std.date;              
 I get a conflict:

 E:\d\dmd\bin\..\src\phobos\std\string.d(2009):
 function std.string.toString conf licts with std.date.toString at
 E:\d\dmd\bin\..\src\phobos\std\date.d(410)

 --- errorlevel 1


 Any way to fix this?
Sure. There are a few ways to approach it. You can alias one of the toString's to make it default like this... import std.string; import std.date; alias std.string.toString toString;
Ah... that works wonderfully, I normally assume the toString to indeed be the std.string one. So the above is the best way to go for me.
 Or you can type out std.string.toString or std.date.toString each time 
 you refer to toString to disambiguate it.
I did that only for the std.date.toString, and had thought that would make things clear, but come to think of it the default would then still not have been properly defined. Thanx. AEon
Mar 26 2005
prev sibling parent "Regan Heath" <regan netwin.co.nz> writes:
On Fri, 25 Mar 2005 23:04:16 -0600, J C Calvarese <jcc7 cox.net> wrote:
 AEon wrote:
 I am presently trying to use th std.date functions to get the current  
 system time, but when I add this code
  import std.string;
 import std.date;                I get a conflict:
  E:\d\dmd\bin\..\src\phobos\std\string.d(2009):
 function std.string.toString conf licts with std.date.toString at
 E:\d\dmd\bin\..\src\phobos\std\date.d(410)
  --- errorlevel 1
   Any way to fix this?
Sure. There are a few ways to approach it. You can alias one of the toString's to make it default like this... import std.string; import std.date; alias std.string.toString toString; Or you can type out std.string.toString or std.date.toString each time you refer to toString to disambiguate it. Here's a brief description of a similar error: http://www.prowiki.org/wiki4d/wiki.cgi?ErrorMessages#ConflictingSymbols
Isn't the real solution to change the std.date alias for d_time into a typedef? Regan
Mar 27 2005