www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.math2

reply Charlie <Charlie_member pathlink.com> writes:
Can we have std.math import math2 ?  There is no mention of math2 in the docs.

Trying to use max(...) function ( which is very cool ) , but when importing
std.math2 and std.string in the same module i get :

c:\dmd\bin\..\src\phobos\std\math2.d(933): function std.math2.toString conflicts
with std.string.toString at c:\dmd\bin\..\src\phobos\std\string.d(1777)

Is this meant to be used ?  If so how can I avoid this conflict.

Charlie
Nov 13 2004
parent reply Tyro <ridimz_at yahoo.dot.com> writes:
Charlie wrote:
 Can we have std.math import math2 ?  There is no mention of math2 in the docs.
 
 Trying to use max(...) function ( which is very cool ) , but when importing
 std.math2 and std.string in the same module i get :
 
 c:\dmd\bin\..\src\phobos\std\math2.d(933): function std.math2.toString
conflicts
 with std.string.toString at c:\dmd\bin\..\src\phobos\std\string.d(1777)
 
 Is this meant to be used ?  If so how can I avoid this conflict.

Don't know if was meant to be so, but you may avoid the conflict by qualifying which toString you intend to use: the function call would be: std.math2.toString(...); or std.string.toString(...); Or if you are only using toString() from a single source you may alias it as: alias std.string.toString toString; The real fix to this problem is to remove to toString() function from the math2 module. toString() functions should all be localized to std.string.
 Charlie
 
 

Nov 14 2004
parent Charlie <Charlie_member pathlink.com> writes:
but you may avoid the conflict by 
qualifying which toString you intend to use:

Your right, sounded like a silly question right after I hit send :( ,( only because Ive been using D for a while and should know better ). You explained it very well btw :).
The real fix to this problem is to remove to toString() function from 
the math2 module. 

I agree totally. I think its a serious problem when I can't import two modules of the "Digital Mars Endorsed" runtime library without getting conflicts. I don't think its a name resolution problem, I think its a phobos problem. But I know we've beaten this one to death already so Ill leave it alone. ( But there is two toString( real ) functions , one in std.math2 the other in std.string ) Charlie In article <cn7p9i$1o7a$1 digitaldaemon.com>, Tyro says...
Charlie wrote:
 Can we have std.math import math2 ?  There is no mention of math2 in the docs.
 
 Trying to use max(...) function ( which is very cool ) , but when importing
 std.math2 and std.string in the same module i get :
 
 c:\dmd\bin\..\src\phobos\std\math2.d(933): function std.math2.toString
conflicts
 with std.string.toString at c:\dmd\bin\..\src\phobos\std\string.d(1777)
 
 Is this meant to be used ?  If so how can I avoid this conflict.

Don't know if was meant to be so, but you may avoid the conflict by qualifying which toString you intend to use: the function call would be: std.math2.toString(...); or std.string.toString(...); Or if you are only using toString() from a single source you may alias it as: alias std.string.toString toString; The real fix to this problem is to remove to toString() function from the math2 module. toString() functions should all be localized to std.string.
 Charlie
 
 


Nov 14 2004