types

Robert Sayre sayrer at gmail.com
Sun Aug 17 16:29:47 PDT 2008


On Wed, Aug 13, 2008 at 11:02 PM, Peter Michaux <petermichaux at gmail.com> wrote:
> Are these
> type-related features what the community of ECMAScript 3 programmers
> were really asking for emphatically years ago?

No need to take a poll here. It's better to look at existing programs
and examine whether a proposal for static type syntax would make them
shorter at the function level and as a whole. Sufficiently shorter
programs justify the implementation and standardization burden,
because of the number of bugs that would go unwritten.

I've seen and written enough allegedly functionally-enlightened
JavaScript to know that programs written in that style usually spend a
high proportion of lines doing type inspection at run time. It's
usually what prevents such programs from being incredibly concise. Of
course, it's certainly possible that any effective syntax for static
types in ES could make programs longer and more verbose, so I don't
think it's worth debating the notion in the abstract.

Also, I think comparisons with Java miss the mark, since Java doesn't
have lexical closures, first-class functions, convenient property
access, or convenient object creation syntax, and on and on. Its type
system is just one wart among many, and it's hard to isolate from the
language's other flaws.

- Rob


More information about the Es-discuss mailing list