std.compress

Daniel Murphy yebblies at nospamgmail.com
Tue Jun 11 06:13:57 PDT 2013


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.1001.1370829569.13711.digitalmars-d at puremagic.com...
> On Monday, June 10, 2013 11:44:56 Daniel Murphy wrote:
>> In this case we can prevent problem simply by not giving functions 
>> generic
>> names like 'compress'.  Ideally you should be able to import the entire
>> standard library with no name conflicts.
>
> We've actually made the opposite choice when discussing this in the past.
> We've specifically gone for making functions which do the same thing in
> different modules having the same name (e.g. std.ascii and std.uni), which
> makes swapping one for the other easy and avoids having to come up with
> distinct names, though it does obviously create more naming conflicts when 
> you
> try and mix and match such modules. I'd also point out that it's been 
> argued
> that it's a failure of the module system if we're specifically trying to 
> avoid
> having different modules have functions with the same name. It's the 
> module
> system's job to differentiate such functions, and specifically avoiding 
> naming
> stuff the same to avoid naming conflicts means that you're pretty much 
> ignoring
> the module system.
>
> So, the general approach has been to name functions differently when they 
> do
> different things and name them the same when they do the same thing and 
> then
> let the module system take care of differentiating between the two when 
> you
> need to.
>
> - Jonathan M Davis

The difference here is these are range functions and you lose ufcs.  It 
doesn't make much difference unless you are trying to chain them.

Ranges, and call chaining of range-based functions using ufcs, are among the 
most attractive features of phobos.  Let's define a new general approach, 
and keep them conflict-free when possible.

Also, compress is a ridiculously general name for a function. 




More information about the Digitalmars-d mailing list