std.compress
Steven Schveighoffer
schveiguy at yahoo.com
Wed Jun 5 13:42:14 PDT 2013
On Wed, 05 Jun 2013 15:38:56 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 6/5/13 2:42 PM, H. S. Teoh wrote:
>> Is that even necessary? We could just do this:
>>
>> ----std/algorithm.d----
>> module std.algorithm;
>> public import std.algorithm.search;
>> public import std.algorithm.compare;
>> public import std.algorithm.iteration;
>> public import std.algorithm.sort;
>> public import std.algorithm.set;
>> public import std.algorithm.mutation;
>> ----snip----
>
> For perfect 100% undetectable backwards compatibility:
>
> module std.algorithm;
> private import std.algorithm.search;
> alias balancedParens = std.algorithm.search.balancedParens;
> alias boyerMooreFinder = std.algorithm.search.boyerMooreFinder;
> ...
All this does over public import is avoid adding the full names into the
namespace (which would arguably be OK, since those didn't exist before).
public import already automatically aliases all the symbols for you.
One thing you have to be careful of is if blah is a function in
std.algorithm, and you have a module named std.algorithm.blah, you would
have troubles.
So I would name the modules things like 'std.algorithm.searching' instead
of 'std.algorithm.search', since search is a really good name for a
function.
-Steve
More information about the Digitalmars-d
mailing list