www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Duplicate floor() functions

reply "Bob W" <nospam aol.com> writes:
In reference to compiler message:

"function std.math.floor conflicts with std.date.floor ..."

The floor functions in std.math and std.date are
colliding with each other, thus requiring the
necessity to use "std.math.floor(x)" instead
of "floor(x)" in certain cases. I'd call this a
major nuicance, especially when porting certain
C programs to D.

How about renaming the "floor" function in
std.date, since it is not even mentioned in the
Phobos docs?
Feb 18 2005
parent reply Norbert Nemec <Norbert Nemec-online.de> writes:
Bob W schrieb:
 In reference to compiler message:
 
 "function std.math.floor conflicts with std.date.floor ..."
 
 The floor functions in std.math and std.date are
 colliding with each other, thus requiring the
 necessity to use "std.math.floor(x)" instead
 of "floor(x)" in certain cases. I'd call this a
 major nuicance, especially when porting certain
 C programs to D.
 
 How about renaming the "floor" function in
 std.date, since it is not even mentioned in the
 Phobos docs?

Why not use an alias? The whole point of a good module system is, that it separates symbols into namespaces and allows solving conflicts in an easy way. (Even better would be, of course, if conflicting routines from different modules were automatically handled as overloads of each other. I think that issue was discussed before?)
Feb 19 2005
parent reply Ben Hinkle <Ben_member pathlink.com> writes:
In article <cv74jf$24d3$1 digitaldaemon.com>, Norbert Nemec says...
Bob W schrieb:
 In reference to compiler message:
 
 "function std.math.floor conflicts with std.date.floor ..."
 
 The floor functions in std.math and std.date are
 colliding with each other, thus requiring the
 necessity to use "std.math.floor(x)" instead
 of "floor(x)" in certain cases. I'd call this a
 major nuicance, especially when porting certain
 C programs to D.
 
 How about renaming the "floor" function in
 std.date, since it is not even mentioned in the
 Phobos docs?

Why not use an alias? The whole point of a good module system is, that it separates symbols into namespaces and allows solving conflicts in an easy way. (Even better would be, of course, if conflicting routines from different modules were automatically handled as overloads of each other. I think that issue was discussed before?)

That would work but looking at the floor() in std.date it looks to me like it should be private.
Feb 19 2005
parent "Bob W" <nospam aol.com> writes:
"Ben Hinkle" <Ben_member pathlink.com> wrote in message 
news:cv7d9m$2eut$1 digitaldaemon.com...
 In article <cv74jf$24d3$1 digitaldaemon.com>, Norbert Nemec says...
Bob W schrieb:
 In reference to compiler message:

 "function std.math.floor conflicts with std.date.floor ..."

 The floor functions in std.math and std.date are
 colliding with each other, thus requiring the
 necessity to use "std.math.floor(x)" instead
 of "floor(x)" in certain cases. I'd call this a
 major nuicance, especially when porting certain
 C programs to D.

 How about renaming the "floor" function in
 std.date, since it is not even mentioned in the
 Phobos docs?

Why not use an alias? The whole point of a good module system is, that it separates symbols into namespaces and allows solving conflicts in an easy way. (Even better would be, of course, if conflicting routines from different modules were automatically handled as overloads of each other. I think that issue was discussed before?)

That would work but looking at the floor() in std.date it looks to me like it should be private.

I fully agree.
Feb 19 2005