Modern JavaScript

| 2 Comments

(or They Get it Right in Version 5)

ECMAScript 5 finally has strict mode. JavaScript's strict mode forces static function scoping and variable declaration, enforces read-only properties, forbids often-confusing octal literal declarations, and variable name collisions.

In other words, strict mode will help identify common coding mishaps which can cause unintended consequences and painfully unnecessary debugging sessions. Disciplined and careful coders can probably get away with writing sloppy code, but strict mode helps everyone write slightly better code.

If this reminds you of Perl 5's strict pragma, perhaps in 16 years (Perl 5.000 released on 17 October 1994) ECMAScript's strict mode will be mostly uncontroversial among JavaScript programmers.

2 Comments

Unfortunately, it also disables access to caller, meaning that there is now no facility for generating a stack trace. There's been some mumbling about making a new API to show the user a stack trace, but so far I think it's an annoying loss. The rest of the changes are incredibly valuable, though.

Very cool! I like that you can also use it inside of a function, so my libraries can incrementally migrate from sloppy to strict.

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

affiliated with ModernPerl.net

Categories

Pages

About this Entry

This page contains a single entry by chromatic published on December 15, 2010 10:22 AM.

Promoting Good Perl Books in Libraries was the previous entry in this blog.

Create, then Authenticate as User in Catalyst is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Sponsored by Blender Recipe Reviews and the Trendshare how to invest guide

Powered by the Perl programming language

what is programming?