Ka-Ping Yee wrote:
Ben Laurie wrote:
BTW, if you would like to explain why you don't think bound methods are the way to go on python-dev, I'd love to hear it.
Guido van Rossum wrote:
Using capabilities, I would have to hand her a bunch of capabilities for various methods: __getitem__, has_key, get, keys, items, values, and many more. Using proxies I can simply give her a read-only proxy for the object. So proxies are more powerful.
There seems to be a persistent confusion here that i would like to dispel: a capability is not a single lambda.
Guido's paragraph, above, seems to believe that it is. In fact, the pattern he described is a common and powerful way of using capabilities. A capability is just an unforgeable object reference. In a pure capability system, the only thing you can do with a capability is to call methods on it (or, if you prefer, all you can do is send messages to it). Interposing an object to expose only a subset of another object's API, such as a read-only subset, is exactly the power capabilities give you.
I think this is an implementation detail, as I have mentioned before. A capability is a thing with certain properties, as discussed ad nauseam. You can implement them using bound methods or using opaque objects. Personally, I'd like to do both, but if I had to choose, I'd use bound methods.
Yes, this probably is a shift in position - I'm still trying to figure this stuff out, is my excuse!