Zope & Python
Grant Griffin
g2 at seebelow.org
Tue Sep 19 03:32:52 EDT 2000
Tim Peters wrote:
...
> Which just goes to show again that the man has no sense of humor <wink>: at
> the time he let "protected" get in, he should *also* have insisted on
> adding, say, "volatile protected", "const private", and "public protected
> private public" (+ the other 80 of that ilk). I'm sure that if he had, we'd
> see dozens of books now explaining the crucial differences among all of them
> <0.7 wink>.
<hehe> Hey, that's pretty good! Maybe you oughtta take up programming
language design. <wink>
> As to friends, what's the problem? It's better to avoid them when you can,
> but in a language without multimethods it's a fine way to let (possibly
> overloaded) functions get at the guts of all involved classes.
Well, given the idea that public/protected/private aren't of any real
use, who really needs friends? ;-)
As the C++ FAQ explains it, "friend" is a "Hogan's Heroes Tunnel" under
a wall that you've erected using protected/private. However, "friend"
has always bugged me at an asethetic level not just for its vaguely "Mr.
Roger's Neighborhood" overtones ("Can you say, 'friend'? Uh-huh, I
thoughtcha could!") but because it seems a little disingenuous to erect
a wall, then let folks tunnel through. After all, if _walls_ are good,
don't let _anybody_ through, and if _freedom_ is good, then just use the
GPL (oops!)
Actually, since I _do_ use protected and private, I've ended up using
friend too. My history has been to originally write my code at some
moderate level of protection, then, as I work with it, to gradually tear
down or defeat the walls. (Luckily, all that stuff is in header files,
so it's easy to defeat. <wink>)
just-because-your-partner-class-is-a-friend-doesn't-mean-you
-shouldn't-use-protection-with-strong-walls,-Kids-<wink>-ly y'rs,
=g2
--
_____________________________________________________________________
Grant R. Griffin g2 at dspguru.com
Publisher of dspGuru http://www.dspguru.com
Iowegian International Corporation http://www.iowegian.com
More information about the Python-list
mailing list