public aliases to private/package symbols

Sönke Ludwig ludwig at informatik.uni-luebeck.de
Wed Jan 25 03:11:20 PST 2012


Am 25.01.2012 11:02, schrieb Nick Sabalausky:
> "Nick Sabalausky"<a at a.a>  wrote in message
> news:jfojur$2a7l$1 at digitalmars.com...
>> "Sönke Ludwig"<ludwig at informatik.uni-luebeck.de>  wrote in message
>> news:jfoh1s$25ce$1 at digitalmars.com...
>>> Another example would be synchronized classes:
>>>
>>> synchronized class X {
>>> public alias f g;
>>> private void f(){}
>>> }
>>>
>>> Now g() would be a public method that is not protected by the class'
>>> mutex. This case would have to be explicitly forbidden.
>>
>> Or just cause f to be protected by the class's mutex.
>
> After all, if you're making a public alias of f, then you obviously *do*
> want that function to be public-accessible, just not through the *name* "f".
>
>

...although it would be a bit awkward to have the original function 
change just because it is aliased somewhere (a bit like Schrödinger's cat).

But actually I realize that there are far worse things concerning 
shared/synchronized + classes, so my example maybe is not really 
specific to 'alias' (e.g. I'm not sure what happens now if you make a 
delegate of f()...)


More information about the Digitalmars-d mailing list