Aliases and permissions [was: Re: extern(C++, NS)]

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 29 04:58:57 PST 2015


On Sunday, 29 November 2015 at 12:39:14 UTC, Joseph Rushton 
Wakeling wrote:
> On Sunday, 29 November 2015 at 04:57:28 UTC, Walter Bright 
> wrote:
>> Aliases do not change access permissions. They are just 
>> aliases.
>
> Note that this is a problem beyond Manu's use-case.  Example: 
> subtyping via alias this currently requires the alias'd entity 
> to be public, contra the example given on TDPL p.231 (see 
> https://issues.dlang.org/show_bug.cgi?id=10996 for details).
>
> This means that to use subtyping in practice requires internal 
> implementation details to be revealed to the user, which isn't 
> very nice :-(

As long as aliases effectively disappear in the compiler once a 
replacement has been made, and they don't end up in error 
messages, allowing aliases to muck with anything about the 
original symbol seems like a recipe for disaster, though I can 
certainly see why folks would want it (and arguably, it would be 
a lot more user-friendly if the aliases showed up in the error 
messages along with the original symbol rather than outright 
disappearing).

- Jonathan M Davis


More information about the Digitalmars-d mailing list