develooper Front page | perl.perl6.language | Postings from July 2010

Re: Breaking encapsulation by detaching a private-variable-accessingmethod from one object and calling it on another

Thread Previous | Thread Next
From:
Brandon S Allbery KF8NH
Date:
July 31, 2010 11:36
Subject:
Re: Breaking encapsulation by detaching a private-variable-accessingmethod from one object and calling it on another
Message ID:
4C546D12.2080609@ece.cmu.edu
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/31/10 14:23 , Carl Mäsak wrote:
> a. Allow this form of encapsulation breakage.
> b. Disallow detaching of certain methods.
> c. Disallow attaching of certain anonymous methods.
> 
> I must confess I don't particularly like either option. I'm by no
> means an OO expert. It would be interesting to hear your views on
> this.

The whole concept of detaching and attaching methods seems suspect to me; in
particular, attaching a method from a class not declared to be related reeks
of monkey patching.  As such, I'd only allow it when monkey patching is enabled.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxUbRAACgkQIn7hlCsL25URzACfeQwHqlQWs4IL6RdSCkkI1inr
BasAoM0LyLl19dylqoOcMjCfk3kvC9j3
=FyAF
-----END PGP SIGNATURE-----

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About