[cap-talk] Composability and RAII

David Barbour dmbarbour at gmail.com
Sun Mar 20 10:10:44 PDT 2011


On Sun, Mar 20, 2011 at 3:02 AM, Rob Meijer <capibara at xs4all.nl> wrote:
> If, as David-Saray claims a resource is anything that requires explicit
> release, and the property of 'being a resource' is ,as what I understand
> from what David-Saray claims, transitive to composition, than any form of
> polymorphism would require the assumption of 'being a resource'. This in
> term would mean that each and every interface would need to include a
> 'release()'.

That isn't the case. Supposing Alice holds a resource, Alice could
present Bob with an abstraction that accesses the resource but does
not expose a 'release()' authority. Under these circumstances, Alice
is holding a resource and Bob is holding some alternative service. The
property of 'being a resource', hence, is not transitive across
composition. Resources may be encapsulated by the facet pattern.
Indeed, the 'with(resource,action)' pattern that obtains the resource
but hides the facet for releasing it... is, indeed, an example of this
encapsulation, but limited to stack scope.

David-Sarah's argument is that 'being a resource' is a property of the
abstraction and protocol we are presented. I don't agree with his
particular choice of abstraction and protocol, but the underlying
position is sound. After all, the very notion of 'resource' is an
abstraction.


More information about the cap-talk mailing list