Re: Taming constructors?
"Mark S. Miller" <[email protected]>
| Newsgroups | gmane.comp.capabilities.general |
|---|---|
| Message-ID | <CABHxS9i_R2bdPGwHYWR-QO9BbedFZYZ_=Khi_q4KssdhYuN=qw@mail.gmail.com> |
The WeakMaps of EcmaScript 6 provide even better support for rights
amplification. First, they enable the trivial creation of sealer/unsealers:
function makeSealerPair() {
var wm = new WeakMap();
return def({
seal: function(payload) {
var box = def({});
wm.set(box, payload);
return box;
},
unseal: function(box) {
return wm.get(box);
}
});
}
Second, WeakMaps support better rights amplification patterns when used
directly, rather than through the sealer/unsealer abstraction. Compare the
MintMaker of <
http://erights.org/elib/capability/ode/ode-capabilities.html#simple-money>
and <http://research.google.com/pubs/pub40673.html>. The direct use of
WeakMaps for rights amplification enables the second to avoid the getDecr
function needed by the first.
On Wed, May 7, 2014 at 9:12 PM, Norman Hardy <norm-vN3M59HtaNxWk0Htik3J/[email protected]> wrote:
> I certainly think so. I began to implement the factory in Scheme and was
> reminded that Scheme lacks efficient synergy or any primitive to build it.
> http://cap-lore.com/Languages/Scheme/Synergy.html
> Some languages accidentally build it in, such as C++, OCaml, Smalltalk as
> part of their class structures.
> The original 1973 paper by Moriss suggests a simple sealer-unsealed
> primitive which I have not seen adopted in any wide spread language.
> Jonathan Rees has a variant of Scheme with efficient synergy.
>
> On 2014 May 6, at 18:55 , David Nicol <[email protected]> wrote:
>
>
>
>
> On Thu, May 1, 2014 at 9:07 AM, Kevin Reid <kpreid-M/[email protected]> wrote:
>
>>
>> I think that this is not a useful pattern in a capability language
>>
>
> the "factory pattern" is how one does constructors in a capability
> language, no?
>
>
>
>
> --
>
> "you are browsing from
> crawler0-complaints-to-admin.webresearch.pa-x.dec.com on the
> webresearch.pa-x.dec.com network."-- 1998 snapshot of dynamic page at
> archive.com
> _______________________________________________
> 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
>
>
--
Cheers,
--MarkM
_______________________________________________
cap-talk mailing list
[email protected]
http://www.eros-os.org/mailman/listinfo/cap-talk