Posts

The Notebook Problem

Image
For the last few days, my attention has been caught up in the “notebook problem.”   Yes, Ebola has now been found in America; ISIS continues its reign of terror; the drought in the western United States has become dire for farmers and anyone with a lawn; and racial unrest in Ferguson boils over every night as darkness falls.   Yet, here I am worried about notebooks.   I guess it is about how I obsess over those other things that makes me concerned about my notebooks because it is in my notebooks that I mull over the state of the world, the way we live now, the future and the past and of course, the present. As the world turns, I compulsively write.   I note.   I get down the words and phrases I hear.   I record the drama and the comedy.   I cannot stop my hands on the keyboard or from moving across a page.   Last month, I wrote more than 17,000 words and 27 single-spaced pages in a file on my computer called “Chronicle,” but is, in fact, my journ...

ECMAScript 6 promises (1/2): foundations

Image
This blog post is outdated. Please read chapter “ Asynchronous programming (background) ” in “Exploring ES6”. This blog post explains foundations of asynchronous programming in JavaScript. It is first in a series of two posts and prepares you for part two , which covers promises and the ECMAScript 6 promise API. The JavaScript call stack When a function f calls a function g , g needs to know where to return to (inside f ) after it is done. This information is usually managed with a stack, the call stack . Let’s look at an example. function h(z) { // Print stack trace console.log(new Error().stack); // (A) } function g(y) { h(y + 1); // (B) } function f(x) { g(x + 1); // (C) } f(3); // (D) return; // (E) Initially, when the program above is started, the call stack is empty. After the function call f(3) in line (D), the stack has one entry: Location in global scope After the function call g(x + 1) in line (C), the stack...

ECMAScript 6 modules: the final syntax

Check out my book (free online): “ Exploring ES6 ”. Updated version of this blog post: chapter “ Modules ”. At the end of July 2014, TC39 [1] had another meeting , during which the last details of the ECMAScript 6 (ES6) module syntax were finalized. This blog post gives an overview of the complete ES6 module system. Module systems for current JavaScript JavaScript does not have built-in support for modules, but the community has created impressive work-arounds. The two most important (and unfortunately incompatible) standards are: CommonJS Modules: The dominant implementation of this standard is in Node.js (Node.js modules have a few features that go beyond CommonJS). Characteristics: Compact syntax Designed for synchronous loading Main use: server Asynchronous Module Definition (AMD): The most popular implementation of this standard is RequireJS . Characteristics: Slightly more complicated syntax, enabling AMD to work without eval() (or a compilation step). Designed for asynchron...

How About Never--Is Never Good For You?

Image
It is probably not fair that I read and loved Roz Chast’s cartoon memoir of her last years with her parents before I read Bob Mankoff’s similar reflections on his life in How About Never—Is Never Good For You?: My Life in Cartoons (Henry Holt and Co., 2014).   Both are great cartoonists; Bob Mankoff is the cartoon editor at The New Yorker while Chast is one of many in the humorous illustration business at the magazine.   Both books consist of drawings and prose, making them unique in the way they tell a life story.   However, that is also where the two diverge dramatically.   Chast’s memoir was both sad and funny in equal measure and focused on a specific time in her life.   Mankoff goes for a mix of autobiography and an analysis of cartoon humor and specifically, humor at The New Yorker.   In this way, his book is less funny, although there are some classic cartoons reprinted here, many from other cartoonists that Mankoff has edited over the years as we...