Should alias expand visibility?

Tomek Sowiński just at ask.me
Mon Jul 26 10:59:42 PDT 2010


Steven Schveighoffer wrote:

> On Sun, 25 Jul 2010 18:23:52 -0400, Tomek Sowiński <just at ask.me> wrote:
> 
>> If foo is private but its public alias poo exists, should you be able to
>> use
>> poo? (currently you can't)
> 
> I don't know, it'd be awfully messy, usually people keep it private.

What you mean by "awfully messy"? Compiler internals?

I was asking for aliases and visibility because in my QuantLibD project I 
had this idea:

struct PermutationMatrixExpr(Permutation permut) {
    static if (permut == Permutation.RowWise) {
        alias byPermutationDim byRows;
        alias byPermutationOrthoDim byColumns;
    } else {
        alias byPermutationDim byColumns;
        alias byPermutationOrthoDim byRows;
    }

private:

// Definitions for byPermutationDim & byPermutationOrthoDim

}

I don't want to expose byPermutationDim & byPermutationOrthoDim because the 
names are not understandable by wide audience. Sure, I could've used a one-
line wrappers, but that means messier code, work for compiler to inline, 
debug mode runs slower, etc.


Tomek


More information about the Digitalmars-d mailing list