Keep Working, Worker Bee!

10.20.2005

On Sunday, I had a meeting with Mike and Dave to discuss the future of Topsl. One very productive decision we all finally came to agree on at this meeting is that a web survey is inherently a two-phase computation: one phase that runs statically (i.e., before anyone takes the survey) with and one that runs dynamic (i.e. as someone is taking the survey). The static phase just takes the survey from something the user types in, which might have convenient abstractions or computations that are only meant to happen once or whatever, to a fully-elaborated program; that program then runs as the dynamic phase.

So as we were talking about that, Dave or Mike (I forget who) brought up a problem. If you want to perform a map over a list of, say, strings to turn them all into questions, that's no problem. On the other hand, if after you've done that the survey author contacts you and says they want to add the currently-logged-in user's name to one or all of those questions, now you're screwed: you don't have static access to variables bound at runtime, for the obvious reason that their values aren't known yet. That causes a big problem wherein a small tweak can force a large reorganization, something we all wanted to avoid. So we had the idea to have an opaque value representing a variable bound only dynamically by Topsl but available statically, so as long as you don't actually need to observe the value of the variable you can include it when you're generating Topsl code.

Today, in a totally different context — discussing my NEU talk of Monday — Eli pointed me towards the notion of "exotic functions" in higher-order abstract syntax and how one approach to eliminating them is to just give variables an opaque type as far as the metalanguage is concerned, which guarantees that you won't use their values for anything. The type system simply won't allow it. If you think about it, that's a typed version of the exact same solution we discovered, and that connection opens up the whole world of HOAS and fresh languages to Topsl.

So, so far, Topsl is related to fresh languages, multilanguage semantics, domain-specific languages, various approaches to static analysis, and staged computation, at least. Is there anything this goofy programming language isn't related to?

0 Comments:

Post a Comment

<< Home