2012-02

Exemplar patterns in JavaScript

[2012-02-06] dev, javascript, jslang
This post explores exemplars (factories for objects) and how to implement them. The term exemplar has been proposed by Allen Wirfs-Brock to avoid the term class, which is not a good fit for JavaScript: Exemplars are similar to classes, but they are not classes.

PDF.js: display PDF files in your browser, without native code

[2012-02-04] browser, library, dev, firefox, javascript, computers, pdf
Quite amazing: PDF.js is a JavaScript library that displays PDFs in browsers. At version 0.2, it comes with the requisite warning: “Note: This is an early-stage prototype. Several documents might not render properly.”

Servo: a vision for the future of Firefox

[2012-02-02] rust, dev, firefox, computers, servo, mozilla
Updates:
  • 2012-06-28: Restructured much of the content, to make it easier to digest.
  • 2012-06-27: New section “More information on Servo”.
Recently, Mozilla stopped the Electrolysis project [1] that was to give Firefox per-tab processes. Hence, I was relieved when David Bruant pointed out to me that Mozilla haven’t given up on a parallel browser. They are working on a project called Servo which is being implemented in the Rust programming language.

2012-01

What is {} + {} in JavaScript?

[2012-01-29] dev, javascript, jslang
Recently, the lightning talk “Wat” by Gary Bernhardt pointed out an interesting JavaScript quirk: You get unexpected results when you add objects and/or arrays. This post explains those results.

Trying out Underscore on Node.js

[2012-01-29] underscorejs, dev, nodejs, javascript
Underscore is a library that nicely rounds out JavaScript’s rather limited standard library. Thanks to the Node Package Manager, it’s very simple to install on Node.js:
    $ npm install underscore

The increasing pervasiveness of JavaScript – a few historic milestones

[2012-01-27] dev, javascript, jslang
Update 2012-07-20: O’Reilly has published my mini-ebook “The Past, Present, and Future of JavaScript”. It is free, but you have to enter a name and an email in the box at the right. This ebook can be considered an updated and extended version of this blog post.

JavaScript is used in more and more places. It started out as a scripting language for web content and has migrated to many areas. This post presents the historic milestones of this process. Note: The milestones are about things that changed the public perception of what JavaScript could be used for. Some of these milestones would not have been possible without prior work by others. For example: Mozilla’s contributions in advancing the state of JavaScript cannot be overestimated. The following are the milestones, in chronological order:

JavaScript myth: JavaScript needs a standard bytecode

[2012-01-22] jsmyth, dev, javascript, jslang
The idea is obvious: Why not standardize the bytecode of the virtual machines (VMs) that JavaScript runs on? That would mean that JavaScript programs could be delivered as bytecode and thus would be smaller and start more quickly (after having been loaded). Additionally, it would seem to be easier to port other languages to web browsers, by targeting that bytecode. This post makes its case in two steps: First, it shows that bytecode has several disadvantages. Second, it explains that source code is not as bad a solution as it seems.

What is JavaScript’s typeof operator used for?

[2012-01-20] dev, javascript, jslang
JavaScript’s typeof is a complicated beast – it can be used for many things, but also has many quirks. This post lists its use cases, points out problems and presents alternatives.

The first ECMAScript.next features in Firefox and Chrome

[2012-01-17] esnext, dev, javascript
Update 2012-01-23:ECMAScript 6 support in Mozilla” on the Mozilla Development Network.

The next version of ECMAScript (code-named ECMAScript.next [1]) will be standardized by 2013. This post enumerates the first features that are currently being tested in Firefox and Chrome.

Automatically numbering headings via CSS

[2012-01-12] css, dev, html
This post shows you how to number HTML headings with CSS. That is, given the following HTML.
    <h1>My Article</h1>
    <h2>Introduction</h2>
    <h3>Rationale</h3>
    <h2>Background</h2>
With the proper CSS, the above will be displayed as
My Article
1. Introduction
1.1. Rationale
2. Background