A little bit of CPS, a few thunks, and a trampoline

As promised, I’m going to post some more information about the Clojure TCO project that I’ve been working on with Dan Friedman. For those who missed it, my good friend Eric Holk posted the video from a talk I gave two weeks about it. Just for a little context, I gave this at our informal weekly PL Wonks colloquium series. We keep it pretty light, so there were a number of stops to discuss certain points and quite a few inside jokes.

I apologize to any Clojurers bored by the basics discussed in the video; the IU PL group is primarily made up of Schemers and Haskellers. While they’re no strangers to Lispy languages, few had used or knew much about Clojure.

When the video went up, a number of people asked for slides, so I have made them available here. Also, here’s the video to go with it (via YouTube):

Some notes worth mentioning about the video:

  • At about 4:06, I say that there’s a “cross-compiler from Clojure to ClojureScript.” I of course misspoke myself; I meant to say that it compiled Clojure to JavaScript.
  • At around 11:30 there’s a fairly long discussion comparing Clojure’s use of “recur” to Scala’s automatic self-recursion tail-call optimization. I say in the video that I’m not sure why it’s not automatic in Clojure. Clojurers from IRC have said that it’s to avoid “magic” in the compiler in which one would write code they thought was tail-recursive, but then blows the stack. This actually leads into a possible loop optimization suggested by a fellow IU compiler hacker, but I’ll write more on that later.
  • I mention a couple of IU undergraduate courses by catalog number: C311 is the programming languages course taught by Dan Friedman and P423 is the compilers course originally taught by Kent Dybvig.
  • The video says that the trampoline’s flag is a ref, which was true at the time. I have been informed that this is a faux pas, and the current version uses an atom instead. It may come as no surprise that this was a substantial performance improvement.
  • The demo portion was cut off primarily because I had technical difficulties (as always happens with live code demos).

There is of course tons and tons to say about the work that Dan and I have done. I’ve been chatting with David Nolen for a few days, including about the possibilities of reusing the CPS transformer for asynchronous client-side scripting code with ClojureScript, as well as adding full call/cc and shift/reset to Clojure.

I’ve also got enough ideas to keep work going on CTCO itself for the foreseeable future (especially with finishing my M.S. next week and starting work at a real job in the next month). So if you’re an interested Clojurer, please take a look at the code on Github, fork it, play with it, add to it, and have fun! Also feel free to ask me questions; I try to be prompt about answering email and often appear on the Clojure IRC as cjfrisz.

I’m a bit busy with classes finishing up and other research deadlines, but I hope to keep writing some updates about the inner workings of CTCO and talk about where I would like to take the project from here. Until then, enjoy!

Dusting this old blog off

Well it has certainly been a long while since I wrote anything here. I’ve been a very busy boy, and I’ve got some work to show for it. Dan Friedman and I have been working on adding tail-call optimization to the Clojure language. A video went up a few days ago from an informal talk I gave to the IU PL group a couple of weeks ago about it, and I’ve posted some code to back it up.

Now that it’s starting to get out there, I’m going to try to do some writing about my work. Check back for the slides from the video and some write-ups on the state of the project.

An experimental month

Stuff keeps moving a mile a minute around here. I just got my graduation requirements squared away, so I’m all but set to be Master Frisz come May. Too bad that’s not a real title that people can use and also sounds really dumb. Even with that in place, it’s far from a smooth ride on my way to graduation. I’ve got two classes, one in which Larry Moss talks about how awesome recursion theory is, and the other in which Dan throws crazy PL problems at me twice a week.

I sound like I’m complaining (and I probably am), but the classes are actually pretty fun. The interesting part was writing out this month’s goals. It seems that both my main research projects are set to hit experimental testing this month. The JavaScript Ad Security project will have numbers on how well our machinery detects ads versus the current standard, AdBlock, hopefully by the end of next week. I’ve also thrown together a sweet piece of term-rewriting code for my project with Dan that I wish I could talk about (but it’s a sEcReT). It seems to be working as I want, and so now it’s time to test whether it’s performant.

The other goal I have this month is to line up some job interviews…which is also an experiment of sorts (I guess). I’ve got leads, and even some particularly exciting ones. Trust that I will give details as they come up, though it may behoove me to stay fairly impartial in talking about anything that happens until I nail down plans.

Stay tuned!

Doubling chrisfrisz.com’s digital real estate

I don’t know who told me about it, but it turns out that DokuWiki is really sweet. I suspect it was my good and awesome friend, Lindsey Kuper. I installed it the other day and have had nothing but fun since. I’m a guy who needs a flexible to-do list system, and I’ve ended up being pretty unhappy with everything I’ve used until now. I used to use Remember the Milk, but I found it too heavy for quickly adding new lists and items. My new wiki is quick enough that it scratches my organizational itch any time of the day.

So now, in addition to www.chrisfrisz.com, your #1 source for occasional write-ups on how the sweet, free Internet we have is in danger and other random facts about me, there’s www.chrisfrisz.com/todo. Now you can spy on what I’m doing! Seriously, though, I’m really enjoying having a lightweight place to write down all of the stuff I need to get done. Plus, the knowledge that people can go look at my lists (as unlikely as it is) helps me want to keep working. I also get that sweet endorphin rush from crossing things off.

With the simplicity of getting a wiki going, I think I might actually go so far as to make a real homepage. Only the future will tell!

Hitting the Internet Superhighway like a ton of bricks

Like a ton of awesome bricks! That is, I have my first video on the Internet, and has a whole 10 views. The good folks from the Digital Curation Centre (note the fancy ‘r’ before ‘e’) have posted the videos from IDCC 2011. That includes my first-ever-anywhere invited talk for my first-ever-anywhere first-author paper “Assessing Migration Risks for Scientific Data Formats.” I enjoyed it pretty well myself, so I thought I would share with the class. Enjoy!

Some new projects

Life’s just chugging along, sometimes a bit too fast. Research is making good progress. Classes are going well. It’s terrifying to think that I’m graduating in May, possibly making my first exit from academia for longer than 3 months for the first time in 18 years. Speaking of which, I’ve managed to keep up with everything else well enough that I’m entering into dangerously-close-to-late territory for applying to jobs. D’oh! Well, that’s why my to-do list says to start LaTeX-ing up my CV today. I’ve got some good leads, especially thanks to POPL last month. It’s about that time that I need to act on them, though, or people will forget about me.

Research is good for now. We’re heading toward our inevitable paper for the JavaScript Security project. Er…that is “Empirically Identifying Ad-Related JavaScript Execution Through Dynamic Static Dynamic and Static Program Analysis.” I guess I probably need to come up with a snappier title than that. We’ve been saying we’ll have a paper for what seems like ages now, but we have some preliminary test results and the experimental setup is getting ready. Plus, there’s already something of a built-in time constraint on me getting this project in paper form before I graduate.

I’m also making progress on my sEcReT pRoJeCt with Dan Friedman. It’s my fun little toy of a research project where I get to chat with Dan about goofy program transformations. I need to dig in on that so I can actually talk about what we’ve done.

As for Spidermonkey optimization work…well that’s on the back burner in terms of official work. It seems that Ryan and I both got sidetracked in teaching the undergraduate compilers course. I’m a big fan of the job, so I’m not complaining. And it hasn’t stopped me from putting a Spidermonkey install on my machine to do some work in my spare time (when I find it).

I also decided to get some more work out in the open for people to see. I’ve got two new repositories on Github of goofy stuff I’m working on. One project has to do with that I’m in a computability theory class through the Math Dept. this semester. The course includes work with text register machine language called 1# developed by my professor, Larry Moss. Writing programs in the language is akin to programming a Turing machine, which is to say, not fun. Many of the vast population of computer scientists in the class have written interpreters from a higher-level language to the 1# source. That is, they’ve added some nice features like labels with goto.

That’s all well and good, but not ridiculous enough of a learning experience for me. Rather, I’m going to write a compiler from a pretty high-level language (something resembling one of the intermediate languages from the compilers class I’m teaching) to 1# code. Being a Scheme junkie, it’s again my language of choice. And even though I’m a Chez Scheme acolyte, I’m going to do my best and make it generally R6RS compliant. I’ve already written (and re-written) the runtime, and it seems to be pretty zippy. Well, as zippy as you can expect from a text register machine. I’m working on adding labels and goto today. We’ll have to see where the thing ends up, but I imagine it’ll have a half-dozen to a dozen passes to add some sweet language features and maybe even generate “efficient” code. Of course I know it all seems silly to write a compiler for such a thing. I’m trying to take the opportunity to integrate some Scheme features into my repertoire that I haven’t used (at least for a while), though. Plus, how else am I supposed to feel accomplished when I’m procrastinating from doing real work?

I’ve also got loose plans to write a little Nethack-style RPG in a Lisp-y language. Of course my first intention was Scheme, but I’ve been falling for the Clojure language recently, so I might see how easy it is to rig something up there. There’s no code as of yet, but I’ll try to add some between JS Security, Dan hacking, teaching compilers, recursion theory, Advanced Dan, 1# compiler hacking, and job hunting. Oy, I really shouldn’t have listed all that out…

The final death knell

Many of you (though I use the term “many” lightly) will remember that I wrote about Internet startup Zediva, the movie streaming company using a Rube Goldberg-ian system of DVD players in a California data center coupled with the first-sale doctrine to deliver streaming content while avoiding the licensing fees that the studios have been piling on the likes of Netflix. It seemed a bit ridiculous, but by my estimation it was still legit.

As you may recall from my first report, the MPAA got the California courts to serve the company with an injunction. This led to the hilarious though not entirely ridiculous claim that the judge had ruled infringement was defined by the length of the cable serving the content. At the time, Zediva claimed they would appeal the decision and fight for proliferation of digital content the way consumers wanted it.

I’m actually quite disappointed to report (and quite late about it, too) that Zediva signed their own death warrant at the end of last month. In late October, the company settled with the MPAA and officially laid off the DVD-changing monkeys. One could wish that this would end up as another victory for Internet freedom, but at least we still have the increasingly favorable fight against SOPA.

The lost Protect IP/E-PARASITE/SOPA post

One of the things I claimed I would do toward the end of my stint of writing about digital right was to write about the bill that at that point (in its Senate version) was called the Protect IP Act. The thoroughly terrifying bill gave the Department of Justice the ability to take down any website “dedicated to infringing activities,” and they weren’t even required to give notice if the owner was sufficiently difficult to reach.

Since it’s inception, the bill has undergone a few revisions and a few names, from the appropriately ominous E-PARASITE to its current House iteration SOPA (for the Stop Online Piracy Bill). Big content owners like the MPAA and RIAA have come out in favor of the legislation for the obvious and aforementioned reason that they can legally use government resources to shut down websites they don’t like.

For all my talk doing deep research on this issue I must say that all I’ve just laid out and done before should be enough to convince anyone that this a bad idea. And on top of that, opponents to the bill have come out in droves, big and small. In particular, several notable Internet companies and blogs like Mozilla, the EFF, and Techdirt have been promoting American Censorship Day. Interestingly, there’s also some comments from Vice President Biden about just how bad the bill would be.

All the research I did before was for issues that often seemed like good ideas (“let’s stop child porn” or “shut down copyright infringing companies“) that at their core were actually horrible ones. But this is out and out a bad idea. Every single American should be opposed to this because the very notion of censorship based on what the government doesn’t like is against every notion of free speech we stand for. As always, here’s a link to make your last stand against the bill and keep the Internet free. It wish it felt more ridiculous to write this, but speak up while you still can.

A quick privacy note

My adviser for one of the projects I had previously mentioned wants me to keep it somewhat secret, so I’ve removed that content from my previous post. I’m not so self-indulgent as to think that someone is looking to steal ideas from my blog, but I will nonetheless probably not be making public posts about it in the future. However, I’d like to keep writing about that project and I think there’s a fair number of people (particularly those at IU) who should be able to read about my progress and thoughts. I’m toying with the idea of password-protecting such posts and if anyone is for or opposed to the idea, please let me know.