Tuesday, August 5, 2008

I want a pony #2

Okay, continuing on trying to find obsolete members. One feature that I'm sure everybody would love is a JS static analyzer. And while we're on the topic of JS, how much longer until Mozilla gets ES 4.0 and static typed JS?

Maybe this isn't so much a pony as an entire ranch, though...


Brendan Eich said...

Sorry, no static type checker remains in ES4 as proposed. We dropped it in favor of 'use strict' being a "use sanity and good taste" mode, as in Perl and other languages that have evolved from rougher roots in the '90s (dynamic scope was "in" then for some reason).

On the up side, with enough optional type annotations and like patterns, one could devise a type checker that runs ahead of time and catches some errors then. It's just that ES4 and Ecma TC39 do not aim to specify and standardize such a thing.

But we do need type relations that are sound by various measures, and it should be possible to partially evaluate them in a conservative sense (programs that reach runtime do not need type checks, or need fewer type checks -- there are still loopholes such as the * [any] type).

Whether such a type checker could be used on gradually or partially typed code, without punitively saying "no runtime for you!" or else (more likely) leaving in runtime type tests and saying too little about what you had hoped would be flagged as static errors, remains to be seen.


Anonymous said...