Wednesday, June 27, 2012

Formal Semantics for Top 5 Programming Languages

A recent blog post on undefined behavior in C got me thinking. Being from the ML community, I have a certain appreciation for rigorous formal semantics that can be machine checked. Though practical machine checking is largely a new development, rigorous formal semantics has been with us for decades. Standard ML is the epitome of this approach to language design. The 48-page (128-pp total when including appendices and TOC/index) The Definition of Standard ML - Revised formally specifies the entirety of the language1. Don't get me wrong. The Standard isn't perfect. Indeed, it has some bugs of its own [PDF]. Nevertheless, for the most part, the Standard has raised the level of discourse and enabled succinct yet precise descriptions of a powerful higher-order typed language possible. This approach to modeling, defining, and evolving programming languages has in recent years taken a life of its own having been applied to both new experimental languages as well as time-tested existing languages.

Tuesday, June 26, 2012


Recently, I was looking around for a nice quick and light nonfiction reading. NPR is usually a great source for hearing about new nonfiction. There are many NPR programs where the host invites an author to peddle his or her wares. Alas, this time I was looking for a more concentrated list of potential light reading (where my definition of light reading may differ from yours). Furiously flipping through the NY Times bestseller list yielded a couple of candidates, but quite matched my craving for something similar to Alan Abelson's weekly Up and Down Wall Street column in Barron's, always dangerously witty yet informative. It was then that I stumbled on Timothy Noah's The Great Divergence: America's Growing Inequality Crisis and What We Can Do about It. The Great Divergence is a terrific read for our times. It is actually quite well grounded, citing numerous research papers from economists such as Paul Krugman, Emmanuel Saez, and many others. The book itself is an expansion of Noah's 10-part Slate column on "The United States of Inequality" from 2010. Noah looks at all the usual suspects (demographics, immigration, automation/computers, government policy, globalization, and education) and grills each against the long history of research findings and data.

Wednesday, June 20, 2012

Garbage Collection in JavaScript, Part 2

Of the Chrome V8 JavaScript engine's 198kloc source (excluding comments), about 19kloc comprise the garbage collector. It is a generational Cheney copying collector with mark sweep. In October 2011 the V8 team added an incremental garbage collector to the mix. Incremental garbage collection contrasts with traditional stop-the-world garbage collection in that it is more amenable to low-latency applications requiring minimizing garbage collection pauses at the cost of reduced total throughput. The V8 garbage collector actually has a whole assortment of configurable flags (see shell --help). If these options can be tweaked, one can provide a customized JavaScript experience (especially garbage collector experience) tailored to the particular performance needs of the app.

Tuesday, June 19, 2012

The Scientific Method and Epistemology

photo by widdowquinn via PhotoRee

Listening to a past Intelligence Squared discussion on whether "Science will have all the answers", or as interpreted by one of the panelist "science is the only route to knowledge." This question lies in the purview of epistemology, the study of the nature of knowledge and the limits of that knowledge. Curiously enough, all this question is ultimately wrapped up in mathematical logic. Taking a step back, consider for a moment when you were first introduced to the scientific method. Hypothesize, predict, and test. It sounds all nice and intuitively rigorous, but where does it come from? Why does it supposed to intrinsically make sense? It turns out that there is nothing really fundamental about this formulation of investigation. My sense of the matter is that people still treat science very superstitiously as if it were some kind of magic or dogma. From grade school on, we were taught the one true answer as to how the natural world works. We revere Galileo and Darwin, and their respective scientific discoveries as if they received the discoveries from the heavens and did not require experimentation, hotly debated peer review, and eventual validation by other work. Moreover, we were taught at least implicitly that these great scientists were never wrong. Their theories never had to be revised or be subject to independent validation. Moreover, it seems as if we think that their theories are and were always the only reasonable answer. There is a kind of survivor's bias in science education. We laugh off Lamarck and others as being so obviously wrong and even as absurd forgetting that they were real scientists too despite not having directly produced the prevailing theory of our time. In fact, I dare say that it would be difficult to say what our understanding of the world would look like today if not for these other scientists upon whose work still contributed to the development of our current understanding of the world. Even the scientific method itself is treated as received knowledge and not as an amalgam of multiple reasonable routes of scientific investigation. Science itself is presented as a winner-takes-all activity.

Monday, June 4, 2012

Skills Shortage

The Time Magazine has a recent article on Skills Shortage written by a Wharton professor. The key take-away is that businesses are leaving vacancies open due to lack of interest in training employees, matching pay with market demands, and other reasons unrelated to candidates' actual lack of knowledge. I've considered this phenomenon at length. One example of lack of interest in training the article had was an opening for a cotton candy machine operator which demanded considerable experience in successful cotton candy machine operation. My personal favorite, from my own observations, was a Craigslist job ad from 2007 for an iPhone app developer with 5+ years of iPhone dev experience. Considering that the iPhone had been released for barely a few weeks, I presume that 5 years would be hard to come by even from the original iPhone engineers themselves. This brings me to the main subject: job training is a real problem these days. Businesses don't want to invest in training because the days of stable, long-term employment is long gone. Young employees move from job to job. Employers don't feel to responsibility to employees they used to when mass layoffs and restructuring are the norm.