Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Private attributes in Perl 6 objects

by Arunbear (Prior)
on Nov 03, 2015 at 11:11 UTC ( [id://1146802]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Private attributes in Perl 6 objects
in thread Private attributes in Perl 6 objects

There may probably be some good reasons for that behavior, but I find it is sort of a pity that the default new constructor can't deal with private attributes
Allowing a private attribute to be set via the constructor (in the way you're trying to do) effectively makes the attribute public, since it is now exposed to the outside world.

The whole point of private attributes is that they are unknown to the outside world, so the class author can change them without affecting users of the class.

Do you know what Tight Coupling means? Making private attributes public, and use of inheritance both guarantee Tight Coupling.
  • Comment on Re^3: Private attributes in Perl 6 objects

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-04-18 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found