Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 26, 2005 toString conflic importing std.string & std.date? | ||||
---|---|---|---|---|
| ||||
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? |
March 26, 2005 Re: toString conflic importing std.string & std.date? | ||||
---|---|---|---|---|
| ||||
Posted in reply to AEon | 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/ |
March 26, 2005 Re: toString conflic importing std.string & std.date? | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | 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 |
March 28, 2005 Re: toString conflic importing std.string & std.date? | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | 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
|
Copyright © 1999-2021 by the D Language Foundation