Should alias expand visibility?
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jul 26 12:44:24 PDT 2010
On Mon, 26 Jul 2010 15:08:32 -0400, Tomek Sowiński <just at ask.me> wrote:
> Nick Sabalausky wrote:
>
>>> Sorry you had to go through that. My post was an attempt at dry humor
>>> ;)
>>>
>>> -Steve
>>
>> Heh, now I get it too. Good one :)
>
> Now me too:) But let's stay on the path:
>
> private void foo();
> public alias foo goo;
>
> We gotta do something about this WTF. Either goo should be perfectly
> usable
> or the compiler shouldn't allow visibility expanding aliases. Which'd you
> pick?
Serious now:
Your simple example doesn't make any sense. Why wouldn't you just make
foo public? If it's publicly accessible through an alias, it's publicly
accessible. I don't buy the "too hard to understand" argument. Just
don't document the "private" members :)
IMO, protection attributes applied to an alias make no sense whatsoever.
I don't think the above code should compile, except dmd accepts lots of
noop attributes...
Let me draw a parallel example:
int x;
const alias x y; // I want y to be a const view of x
Does this make any sense?
-Steve
More information about the Digitalmars-d
mailing list