Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Language design: direct attribute access and postponed mutators (Perl Vs Python)

by LanX (Saint)
on Sep 16, 2019 at 20:11 UTC ( [id://11106258]=note: print w/replies, xml ) Need Help??


in reply to Re: Language design: direct attribute access and postponed mutators (Perl Vs Python)
in thread Language design: direct attribute access and postponed mutators (Perl Vs Python)

True, but the OP wasn't about hiding private attributes, but about maintaining public attributes.

Once you've exposed an attribute in the API and and external code is accessing it directly, it becomes complicated to realize "a man in the middle" layer functioning as getter and setters.

Classic (a bit contrived) example is an attribute .name which needs at some point to evolve to a getter name() returning a concat of .firstname and .lastname (and probably .middlename) without breaking old code.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^2: Language design: direct attribute access and postponed mutators (Perl Vs Python)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found