[Python-Dev] capability-mediated modules (was: python-dev Summary for 2003-03-01 through 2003-03-15) (original) (raw)
Ben Laurie ben@algroup.co.uk
Thu, 20 Mar 2003 15:33:38 +0000
- Previous message: [Python-Dev] capability-mediated modules (was: python-dev Summary for 2003-03-01 through 2003-03-15)
- Next message: [Python-Dev] capability-mediated modules (was: python-dev Summary for 2003-03-01 through 2003-03-15)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Samuele Pedroni wrote:
Making it explicit would make me happy. Can you pass parameters to an import?
not directly, an extension like import module(parmmod=....,...) would not seem totally unreasonable. The problem is that normally modules are uniquely globally identified singletons, but the very notion of parametrization implies instantiation and that breaks the singleton part. When to instatiate a new module and when not? a potential problem is not simply module specific global state but that the e.g. classes exported from two instances of the same module would be distinct and so not interoperable.
I don't think we'd want to change them from being singletons, just restrict access to them based on capabilities. So, I was more thinking of something like:
import(capability) module
where the capability conveys the authority to import the module. Oh. I see the problem: if module A imports module B, and then module A is imported in turn by C and D, with C having a capability to B that it hands to A, but D not doing so, then where are we? I suppose we would say that the import of A into D failed in that case. Of course, this still leaves open the question of how we pass the authority to import into the module, so I guess it would look like:
import(cap1) module(cap2,cap3,...)
and cap2 etc. would have to only be used in the import statements in the module. And this is getting messy.
OTOH, my original idea was that the only modules a capability-enabled module would be allowed to import would be ones that are either capability-safe, or modules in the same "package" (for some definition of package). Any other module would have to be imported by whoever initialised the capability environment, and appropriate capabilities handed in to the capability-enabled objects. This sounds cleaner to me, if somewhat nebulous at the moment.
Cheers,
Ben.
-- http://www.apache-ssl.org/ben.html http://www.thebunker.net/
"There is no limit to what a man can do or how far he can go if he doesn't mind who gets the credit." - Robert Woodruff