CapPython

Caja is an object-capability subset of Javascript. Joe-E is an object-capability subset of Java. Would it be feasible or worthwhile to do a similar subset of Python?

Possible base rules for a Cajita-like Python:

Problem areas:

Python has unfortunate variable binding semantics. Would you really want to use Python for obj-cap programming given this?

There are two ways to do subsetting, with a verifier or with a rewriter. Are there any advantages to not requiring rewriting?

Unsealers

class RemoteProxy(object):
    def __init__(self, connection, object_index):
        self._connection = connection
        self._index = object_index
    def _get_connection_and_index(self):
        return self._connection, self._index
    def cap_invoke(self, args):
        self._connection.send_message(self._index, args)

# Use of this unbound private method could be statically allowed,
# and would be treated as part of the class definition:
unseal_remote = RemoteProxy._get_connection_and_index

# This class object is attenuated so that it can only be used as a constructor.
# This is done implicitly by the rewriter after the class definition:
RemoteProxy = RemoteProxy.__new__

Implementation

A Bazaar repository is on Launchpad: https://code.launchpad.net/cappython

See also

CapPython (last edited 2008-08-17 16:20:18 by MarkSeaborn)