Capability Notions

These patterns arose in the lambda calculus and appeared in limited form in Algol 60. Today they live in Scheme and in a quite a few other modern languages.

Suppose that I write code to define some functionality. I may have a variable integer J with a rôle in defining state. There may be another subsystem F in the system with legitimate need to know whether J is odd, but otherwise has no legitimate need for J. In Scheme when I invoke F I may simply pass the value “(lambda () (odd? J))” probably as an argument in a call to F. This value is a function that F can call whenever it needs to interrogate the current parity of J. F does not need to know the name that I gave to J.

In the last 10 years this pattern has gradually become more prevalent in the form of call-backs. It is a special case of defining a capability which attenuates access to J. F holds the attenuated capability.

This same trivial code illustrates another fundamental capability pattern: I can endow F with the power to learn the parity of J because:

all three of which are via variable references in Scheme which behave as capabilities. I might say
(F (lambda () (odd? J))) in Scheme to achieve this.

In Keykos such a trivial function would be a great deal heavier yet convey exactly the same power. I suspect that the attenuated ability might occupy 80 bytes in Scheme, but 1000 bytes in Keykos.