Re: An object-capability subset of Python

"Brett Cannon" <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On Mon, Aug 11, 2008 at 1:31 PM, Mark Seaborn <mrs-ChQETwBkFSdCgCasaBwmdgC/[email protected]> wrote:
> I have been investigating the feasibility of creating an
> object-capability subset of Python, along the lines of Caja and Joe-E.
> I will call the subset CapPython for now, because the name doesn't
> seem to have been taken yet. :-)
>
> Although Python does not provide encapsulation, there is a widely-used
> naming convention for private attributes of objects: their names start
> with an underscore.  CapPython proposes to enforce this convention by
> only allowing private attributes to be accessed through the "self"
> variable that is bound inside methods.  There are more details here:
> http://lackingrhoticity.blogspot.com/2008/08/introducing-cappython.html
> along with some less readable notes here:
> http://plash.beasts.org/wiki/CapPython

Another option, Mark, would be to prevent access to the free variables
in a closure from outside of a function. If you plug that you can use
closures to provide your private namespace much like you do in
JavaScript. The perk with this is there is a chance of actually
getting this back into the language by removing the __closure__
attribute on functions (or at least I am contemplating trying this at
some point).

-Brett
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.