private alias ... isn't

Derek Parnell derek at nomail.afraid.org
Thu Jun 22 21:55:31 PDT 2006


On Thu, 22 Jun 2006 23:45:59 -0400, David Medlock wrote:

> In several of my utility libraries I have declared :
> 
> private alias char[] string;
> 
> I don't even type char[] any longer, I always type string.
> 
> Every so often I run into conflicts
> 
> alias textures.string conflicts with trees.string ...
> (several lines like this)
> 
> I can usually monkey around with various imports, but its a PITA.
> I don't see any possible benefit for this behavior, if it is intended.
> 
> *** If it is a bug, ignore the rest of this post.
> 
> Names serve a much larger purpose than locating a variable or method, 
> they are *abstractions*.  Why then would a private member be available 
> elsewhere?
> 
> When I type private I expect that declaration to be removed from the 
> namespace when the parser leaves the file.  Thats what *private* 
> means(the English word).  Without power to hide some abstractions from 
> others we leave the world of 'logic' and enter the 'zeros and ones' 
> world again.  Black boxes shouldn't be clear plexiglass.
> 
> -puzzling

This could be any other instance where there is a distinction between
"visibility" and "accessibility".

A private alias may be visible from other modules even though it cannot be
used by that other module.


However, after just testing that theory out, it seems that there is no such
beastie as a 'private alias'. The 'private' qualifier is simply ignored.

Pity, because the concept is sound, IMHO.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
23/06/2006 2:49:54 PM



More information about the Digitalmars-d mailing list