Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: characterstics of private in perl

by adrianh (Chancellor)
on Mar 09, 2003 at 23:59 UTC ( #241629=note: print w/ replies, xml ) Need Help??


in reply to Re: Re^2: characterstics of private in perl
in thread characterstics of private in perl

Well, my understanding of the above is that with sufficient trickery the data isnt really private. But I also agree that they are more or less equivelently private as compared to other things.

I agree - what I was trying to say that the C++ "private" variables are not really private either. We can always just treat the object as a sequence of bytes and get at them that way.

The way I see it the question "How do I do private object attributes" is not the same as "How to I avoid object attribute namespace clashes in inheritance". I would say that the first is just one answer to the second, the one that in many ways is the simplest to implement and may have certain interesting properties, but not the only nor necessarily the best answer by any means.

I agree they are not the only answer - but they are an answer. A nice simple answer in my opinion. I was providing one example of where private object attributes would be useful in perl - which was your request ;-)

With the exception of inside-out objects and closures the problem with other solutions, including package specific keys, is that they rely on the sub-class writer being aware of the mechanism for you to be completely safe. For me "more or less" and "probably won't" isn't good enough.

That probably says something very sad about my personality :-)

As you say, you can get around the problems with a bit of effort. However, the effort is enough that people get it wrong. I resent having to code stuff that the language should take care of for me. This stuff should be simple. Roll on perl6!


Comment on Re^4: characterstics of private in perl

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://241629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2014-09-16 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (9 votes), past polls