Should alias expand visibility?

Steven Schveighoffer schveiguy at yahoo.com
Mon Jul 26 11:37:14 PDT 2010


On Mon, 26 Jul 2010 13:59:42 -0400, Tomek Sowiński <just at ask.me> wrote:

> 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.

Sorry you had to go through that.  My post was an attempt at dry humor ;)

-Steve


More information about the Digitalmars-d mailing list