Monday, December 3rd, 2007

Evolutionary Programming and Gradual Typing in ECMAScript 4

Category: JavaScript

Lars Hansen of Adobe has written Evolutionary Programming and Gradual Typing in ECMAScript 4 which is a tutorial packed with real code for you to diff JS1 and JS2 as it currently stands:

ECMAScript 4 (ES4) provides a range of facilities for evolutionary programming – evolving a program in
stages from a simple script to an ever larger and more reliable software system. The most important facility
for evolutionary programming is the gradual type system; also important are namespaces and packages, union types, generic functions, and reflection.

This tutorial uses a simple library as a running example to illustrate the evolution of a program from the
ES3 “script” stage, via various levels of typing and rigor, to an ES4 package with greater guarantees of
integrity and better performance potential than the original code. We then look at how union types, generic
functions, and reflection can be used to work with a library whose code we can’t modify.

The tutorial uses an example of a browser email system to demonstrate these new features. It takes you step by step through code that evolves to end up looking very JS2-y indeed. You will have to keep an open mind as you look at code filled with classes, namespaces, likes, and more! It is good to see code coming out as part of the conversation.

Posted by Dion Almaer at 7:47 am
Comment here

4.1 rating from 19 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.