archives

Yield : Mainstream Delimited Continuations; "yield" from different languages compared and formalized

Yield : Mainstream Delimited Continuations (PDF), by Roshan P. James and Amr Sabry, TPDC 2011

Many mainstream languages have operators named yield that share common semantic roots but differ significantly in their details. We present the first known formal study of these mainstream yield operators, unify their many semantic differences, adapt them to to a functional setting, and distill the operational semantics and type theory for a generalized yield operator. The resultant yield, with its delimiter run, turns out to be a delimited control operator of comparable expressive power to shift-reset, with translations from one to the other. The mainstream variants of yield turn out to be one-shot or linearly used restrictions of delimited continuations. These connections may serve as a means of transporting ideas from the rich theory on delimited continuations to mainstream languages which have largely shied away from them. Dually, the restrictions of the various existing yield operations may be treated as shift-reset variants that have found mainstream acceptance and thus worthy of study.

I found this work interesting on two different aspects : first, the link between yield and delimited continuations, if not particularly surprising, is nice, and I hope it will interest the participants to the recent delimited-continuation-rage on LtU. I have actually found this paper in one recet LtU thread, but consider it deserve its own topic.

Secondly, I like the idea of comparing related features of different programming languages in a precise, formal way, that is by expressing them all in a common theoretical framework. I would be interested in more references to similar work, for completely unrelated features. After a very quick googling, I found blog posts that partially display similar ambition, such as Comparing Java and C# Generics by Jonathan Pryor, 2007 -- I'm still unsatisfied though, I think generics would make for a very good target for cross-languages comparisons.

The present paper has been mentioned in a few places on the web (two Hacker News thread, one posting on a Mozilla mailing-list), but not generated any discussion that I noticed. You may be interested, however, on the plans for future work of the same authors detailed for a recent workshop, Oleg implementation of yield on top of its Delimcc Ocaml library, and, for those that need to know whether it's a left or right Khan extension to grasp a notion, The Comonad.Reader reconstruction of the paper.

The Trouble with Erlang

Tony Arcieri, author of the Reia Ruby-like language for the Erlang BEAM platform, wrote a piece in July, The Trouble with Erlang (or Erlang is a ghetto), bringing together a long laundry list of complaints about Erlang and the concepts behind it, and arguing at the end that Clojure now provides a better basis for parallel programming in practice.

While the complaints include many points about syntax, data types, and the like, the heart of the critique is two-fold: first, that Erlang has terrible problems managing memory and does not scale as advertised, and that these failures partly follow from "Erlang hat[ing] state. It especially hates shared state." He points to the Goetz and Click argument in Concurrency Revolution From a Hardware Perspective (2010) that local state is compatible with the Actors model. He further argues that SSA as it is used in Erlang is less safe than local state.

What needs to be done?

So suppose like many here (?) you are a believer in the promise of functional programming. And suppose more and more FP features and FP languages are becoming mainstream. Does this mean nothing remains to be done? Certainly not! Among the recurring topics that come up for discussion here are support for concurrency, utilizing GPUs, FRP, dependent typing, fine grained control of effects, native support for web programming and the web stack of technologies and protocols and more.

So what would be your priority list? What would be the first article/web site you'd want the LtU to pay attention to, in order to see the importance of what you deem most important for the future of PLs? Who would be your ideal guest for the proverbial dinner? And what would you ask him (or her!)?

Added clarification:: As can be understood from the discussion below, this message has nothing to do with FP in particular. That's just the teaser. The questions in the second paragraph are entirely general.