January 29, 2009
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.
> > That's actually a good idea.  They don't really fit anywhere else, and
> > 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.
January 29, 2009
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.
>>> That's actually a good idea.  They don't really fit anywhere else, and
>>> 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.

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.