Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by soonix (Canon)
on Sep 15, 2019 at 19:29 UTC ( #11106205=note: print w/replies, xml ) Need Help??


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

Python has __setattr__:
object.__setattr__(self, name, value)
    Called when an attribute assignment is attempted. […]
  • Comment on Re: Language design: direct attribute access and postponed mutators (Perl Vs Python)

Replies are listed 'Best First'.
Re^2: Language design: direct attribute access and postponed mutators (Perl Vs Python)
by LanX (Cardinal) on Sep 15, 2019 at 19:40 UTC
    Thanks, but I think this will be called every time a property is accessed.

    That's like tie'ing the underlying blessed hash in Perl, then every read write access to $obj->{attribute} must be handled via FETCH and STORE.

    This must slow down OO handling considerably.

    The mechanism I described above will only affect especially "enhanced" properties and only when accessed over the external interface.

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2020-07-14 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?