[e-lang] An object-capability subset of Python

Brett Cannon brett at python.org
Tue Aug 12 14:46:26 CDT 2008


On Mon, Aug 11, 2008 at 1:31 PM, Mark Seaborn <mrs at mythic-beasts.com> 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


More information about the e-lang mailing list