UFCS for D

deadalnix deadalnix at gmail.com
Fri Mar 30 05:12:04 PDT 2012


Le 30/03/2012 04:13, Adam D. Ruppe a écrit :
> On Friday, 30 March 2012 at 01:55:23 UTC, Nick Sabalausky wrote:
>> <wishful musing>I've been starting to think
>> more and more that the "everything in a module is a friend" was a
>> mistake,and that we should have instead just had a "module"
>> access specifier like we have "package".</wishful musing>
>
> Or, for moar compatibility, have enemy functions.
>
> class Klingon { private Starship commanding; }
> void nonFriend(enemy Klingon kor) {
> kor.commanding = lol; // error, commanding is private and kor is an enemy
> }
>
>
> Or, to avoid having a new keyword, call it interface
> instead of enemy.
>
> Though, then you could just pass an interface instead of
> a class too. Take most general possible type.
>
>
>
> But, separate modules are kinda cool anyway. I often put
> stuff together in one module just for ease of distribution,
> but eh modules are cool.
>

For the ease of distribution, you can use a module with public import in it.


More information about the Digitalmars-d-announce mailing list