[cap-talk] Objects and Facets
Mark Miller
erights at gmail.com
Mon Aug 7 20:11:37 EDT 2006
On 8/7/06, Norman Hardy <norm at cap-lore.com> wrote:
> (define UDCC (lambda ()
> (let ((c 0))
> (list
> (lambda () (set! c (+ c 1)))
> (lambda () (set! c (- c 1)))
> (lambda () c)))))
> [whitespace inserted above for sanity --MarkM]
> I would like to know how to document the up down counter in the other
> proposed was of speaking.
To expand on Charlie's answer, while using David's "component" suggestion:
Atomic way of speaking:
Each call to the UDCC function creates five relevant objects:
* The location holding the value of the "c" variable.
* The three closures
* The list of these three closures.
The call to the UDCC function returns the list.
The component/facet way of speaking:
* Each call to the UDCC function creates a component consisting of
these same five objects.
* The list is a facet of this component, since the caller is given
access to this list.
* Each of the closures in this list is a facet of this component,
since a calller may potentially
gain direct access to any of these by walking the list.
* The location is encapsulated within this component, since no object
outside the component
can potentially gain direct access to it. (Nevermind that, in
Scheme, locations are not reified.
The above analysis would apply as is even if they were.)
Normally, we may choose to describe the component as not including the
list itself, in which case the component has three closure facets and
one encapsulated location.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the cap-talk
mailing list