I've always been big on the "shotgun quote" not because of the idea that enforcement in not neccessary, but that writing accessors and mutators ad nauseum is silly

... i.e, by convention a blessed hash with internal data should only be accessed externally by class methods, and if the functions don't exist, it's at-your-own-risk. Internal hash-access, thereby being unacceptable/against-convention/etc ...

Bottom line -- everything is private if you agree to stay out of the living room, and that's a great design point. Once you start saying "I have a shotgun, but you can come in if", you start walking down the road of non-OO-OO, aka java-esque accessor/mutator hell.

I suspect there are a lot of yet undiscovered uses for this technique that will only be revealed with time and community acceptance. If nothing else, it will shutup the Java people claiming that Perl OO has poor encapsulation.

As much as I hate Java, I won't defend a failing in Perl when I see it. Perl does have horrible encapsulation, primiarly because of what you had to write to achieve it. Perhaps if stuff like this was in the core module distribution, a la "use ObjectVoodoo" or somesuch, we could argue the language did it well, but as it stands, the language does it poorly, and it becomes the role of the coder to fix the language ... hence (at least) Java speaks it more fluently. Usually java coders get it all wrong though -- and by no means is java a shining example of OO.

In reply to Re: May Thy Closures Be Blessed by flyingmoose
in thread May Thy Closures Be Blessed by hardburn

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":