Re: RFC 188 (v1) Objects : Private keys and methods
[email protected] (Glenn Linderman) Fri, 15 Sep 2000 23:36:50 -0700
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | Glenn and Elaine Linderman, at home |
| Message-ID | <[email protected]> |
Perl6 RFC Librarian wrote: > The effects of applying C<private> to a single hash entry would be to: > > =over 4 > > =item 1. > > mark the entire hash as non-autovivifying (except via future calls to > C<private> -- see below) This is an interesting proposal, but it seems to be missing something, or maybe I am. It seems like once a single hash entry is marked private, that it is then impossible to mark future entries non-private...i.e. there is no corresponding unary "public" function. Now I think I understand that this proposal is for the purpose of OO encapsulation, so that it is less easy for users of a class to directly reference the internal data of the class, so that using the accessor functions is easier. And it also attempts to avoid the name space collisions that can occur when (undocumented, private data) keys from one class are reused in another class through ignorance of the class being inherited from (or ignorance of recent changes to that class). Both of these are laudable goals, and seem to be achieved. However, it seems that one side effect of achieving this is that the hash of interest can no longer be used to present public data of classes inheriting from it--they have no mechanism to add new public data to the hash inherited from the superclass. While some might argue that this is good, others might argue that it is bad, and in the presence of such differing opinions, it certainly seems like that choice should be left to the class author. The proposal also seems to leave somewhat unspecified what happens to other existing non-private keys that were already in the hash at the time the first private key was added. Do they continue to be directly accessible via their names? Do they also get qualified with the package name? Is it an error to insert a private key into a hash already containing non-private keys? -- Glenn ===== There are two kinds of people, those who finish what they start, and so on... -- Robert Byrne ____________NetZero Free Internet Access and Email_________ Download Now http://www.netzero.net/download/index.html Request a CDROM 1-800-333-3633 ___________________________________________________________