May 7, 2012 - Proxies and Frozen Objects

Comments

This post is about how frozen Javascript objects interact with the upcoming Proxy API.

Read more

Mar 29, 2012 - Membranes in JavaScript

Comments

Membranes are a powerful new feature enabled by Javascript proxies, with various use cases. The goal of a membrane is to fully isolate two object graphs. Before I can dive into more practical applications of membranes, I need to explain what a membrane is in more detail, so bear with me.

Read more

Feb 16, 2012 - Operational Semantics of AmbientTalk

Comments

Together with PhD students Christophe Scholliers and Dries Harnie, I recently completed an operational semantics of our AmbientTalk programming language. We believe this is the first formal account of an actor language based on communicating event loops. The paper is currently available as a techreport. From the abstract:

We present an operational semantics of a key subset of the AmbientTalk programming language, AT-Lite. The subset focuses on its support for asynchronous, event-driven programming. AmbientTalk is a concurrent and distributed language that implements the so-called communicating event loops model.

Christophe has written an executable version of the operational semantics in PLT Redex. You can read all about that here.

The operational semantics builds on that of a similar model, JCobox, but significantly adapts it to more accurately reflect the semantics of AmbientTalk’s futures, which are based on E’s promises and are entirely non-blocking. And unlike JCoBox, AmbientTalk does not support cooperative multitasking within an actor, only purely sequential, run-to-completion execution of incoming messages, much like a Javascript per-frame event loop.

Feb 7, 2012 - Designing the ECMAScript Reflection API

Comments

For the past two years, I have been working on a new Reflection API for ECMAScript (the Javascript standard) together with Mark Miller. Its most novel feature is its support for proxies, objects whose behavior in response to a large number of built-in functions and operators can be controlled in Javascript itself.

Last week, I finally finished a paper that not only describes the new API in some detail, but also describes the principles that helped steer our design. From the paper’s abstract:

Read more

Nov 25, 2011 - Harmony Proxies: Tutorial

Comments

Update (July 2015): Proxies are now officially part of the recently released ECMAScript 2015 specification. This tutorial is still relevant, but dated. For up-to-date documentation, see e.g. Mozilla’s MDN page on proxies.

The Proxy API enables the creation of dynamic proxies in Javascript. Dynamic proxies are useful for writing generic object or function wrappers or for creating virtual object abstractions. To avoid any confusion: these proxies have nothing to do with web proxy servers.

Perhaps the most compelling use of proxies is the ability to create objects whose properties can be computed dynamically. Proxies encompass all use cases that one would use the SpiderMonkey hook noSuchMethod for (such as creating mock objects in testing frameworks, Rails ActiveRecord dynamic finder-like capabilities, etc.) but generalize to operations other than method invocation.

Read more