I hereby claim:
- I am tvcutsem on github.
- I am tvcutsem (https://keybase.io/tvcutsem) on keybase.
- I have a public key ASCtXaBpDeiI_yfsA4ztoHV6TUELTu7GkAnyhL5GT-XY9go
To claim this, I am signing this object:
/* | |
* Horton in JavaScript: delegation with blame attribution in an object-capability language | |
* | |
* See http://erights.org/elib/capability/horton/index.html for idea and paper. | |
* | |
* Implementation based on: http://erights.org/elib/capability/horton | |
* (with N-ary message support, lexical nesting and rights amplification) | |
* | |
* To run: | |
* |
// https://github.com/Agoric/layer-cake without generators | |
const { | |
create: objCreate, | |
getOwnPropertyDescriptors: gopds, | |
defineProperties, | |
prototype: objPrototype, | |
freeze, | |
} = Object; |
I hereby claim:
To claim this, I am signing this object:
// a proxy making use of "double-lifting" (i.e. a proxy whose handler is a proxy) | |
var metaHandler = { | |
get: function(dummyTarget, trapName, dummyReceiver) { | |
return function(...trapArgs) { // function acting as a generic trap, its this-binding is irrelevant | |
console.log("intercepting "+trapName); | |
return Reflect[trapName](...trapArgs); // forward manually | |
} | |
}, | |
}; |
load('reflect.js'); // https://github.com/tvcutsem/harmony-reflect/blob/master/reflect.js | |
function makeMembrane(initTarget) { | |
var cache = new WeakMap(); | |
var revoked = false; | |
function wrap(target) { | |
if (Object(target) !== target) return target; // primitives are passed through | |
var wrapper = cache.get(target); | |
if (wrapper) return wrapper; |
load('reflect.js'); // https://github.com/tvcutsem/harmony-reflect/blob/master/reflect.js | |
function makeMembrane(initTarget) { | |
var cache = new WeakMap(); | |
var revoked = false; | |
function wrap(obj) { | |
if (Object(obj) !== obj) return obj; // primitives are passed through | |
var wrapper = cache.get(obj); | |
if (wrapper) return wrapper; |
/** | |
* A convenience method to create a proper Constructor Function | |
* implemented as a function proxy | |
*/ | |
Proxy.createConstructor = function(handler, callTrap) { | |
var proto = new Object(); | |
var ctor = Proxy.createFunction( | |
handler, | |
callTrap, | |
function() { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- using Kris Kowal's Q library, based on CommonJS Promises/B | |
https://github.com/kriskowal/q | |
http://wiki.commonjs.org/wiki/Promises/B | |
Code based on ideas by Mark S. Miller and Dave Herman. The animation example | |
was taken from <http://wiki.ecmascript.org/doku.php?id=strawman:deferred_functions> | |
--> |