Re: Capabilities interact nicely with Substructural Types and Reactivity
"Rob Meijer" <rmeijer-qWit8jRvyhVmR6Xm/[email protected]>
| Newsgroups | gmane.comp.capabilities.general |
|---|---|
| Message-ID | <[email protected]> |
On Thu, September 12, 2013 18:21, David Barbour wrote: > I wasn't speaking of creating any *particular class*, but rather the > ambient authority to `new` in general. > > OOP enables arbitrary subprograms to create internal state and identity. > I.e. the concepts of "state" (including mutable private members) and > "identity" (which can include sealer/unsealer pairs, GUIDs, `eq` on object > references, or even construction of random values) are ambient authorities > in most OOP languages. > > Private constructors have no effect on this at all. > On itself it might not, but when combined with other language features, it could: http://minorfs.wordpress.com/2013/01/18/raiicap-pattern-injected-singleton-alternative-for-c/ This pattern uses private-constructors, friends and templates and optionally polymorphism to create what in an o-cap version of C++ might be considered constructor caps. It would be very interesting to explore if such a construct could be possible in an ocap language. > > On Thu, Sep 12, 2013 at 8:05 AM, Karp, Alan H <[email protected]> wrote: > >> Not being a languages guy, I didnât follow very much of this, but one >> item caught my eye.**** >> >> ** ** >> >> **è **OOP assumes an *ambient authority* to create unique objects, and >> to >> create state that is initially exclusive (which is useful to control >> communication, and for implementation hiding). These authorities are >> useful >> for expressiveness. But they can be problematic from certain security >> perspectives - e.g. when integrating untrusted code, it can be difficult >> to >> enforce deterministic behavior or certain forms of confinement. **** >> >> ** ** >> >> When I want to control who can create new instances, I make the >> constructor private and hand out capabilities to an instance of a >> factory >> method. Of course, that only works for languages that allow me to make >> the >> constructor private, e.g., Java but not JavaScript.**** >> >> ** ** >> >> ________________________**** >> >> Alan Karp**** >> >> Principal Scientist**** >> >> Enterprise Services, Office of the CTO**** >> >> Hewlett-Packard Company**** >> >> 1501 Page Mill Road**** >> >> Palo Alto, CA 94304**** >> >> (650) 857-3967, fax (650) 857-7029**** >> >> http://www.hpl.hp.com/personal/Alan_Karp**** >> >> _______________________________________________ >> cap-talk mailing list >> [email protected] >> http://www.eros-os.org/mailman/listinfo/cap-talk >> >> > _______________________________________________ > cap-talk mailing list > [email protected] > http://www.eros-os.org/mailman/listinfo/cap-talk >