www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: ch-ch-changes

reply Denis Koroskin <2korden gmail.com> writes:
dsimcha Wrote:

 == Quote from Sean Kelly (sean invisibleduck.org)'s article
 Don wrote:
 It's a good point though. Actually, I think abs(), and possibly max()
 and min(), should be in std.object. They're just as fundamental as
 division.

as you say, they're incredibly common to use. Not sure if people would object to these symbols being an implicit part of the namespace of every module though. Sean

Agreed. These are things that are so often used and so basic that even the overhead of having to remember to import something to use them is sometimes too much. As far as namespace pollution, what reasonable person would ever name something max(), min() or abs() if it doesn't do what the standard max(), min() and abs() functions in Phobos do?

std.range could publically import std.algorithm and std.math. This should solve the problem without putting min/max/abs and others into global namespace.
Jan 29 2009
parent Don <nospam nospam.com> writes:
Denis Koroskin wrote:
 dsimcha Wrote:
 
 == Quote from Sean Kelly (sean invisibleduck.org)'s article
 Don wrote:
 It's a good point though. Actually, I think abs(), and possibly max()
 and min(), should be in std.object. They're just as fundamental as
 division.

as you say, they're incredibly common to use. Not sure if people would object to these symbols being an implicit part of the namespace of every module though. Sean

overhead of having to remember to import something to use them is sometimes too much. As far as namespace pollution, what reasonable person would ever name something max(), min() or abs() if it doesn't do what the standard max(), min() and abs() functions in Phobos do?

std.range could publically import std.algorithm and std.math. This should solve the problem without putting min/max/abs and others into global namespace.

Yes, but they are really general functions. IMHO, you shouldn't have to import std.math to do abs() of an integer. It's been a single, trivial asm instruction on just about every CPU ever made.
Jan 29 2009