JS.Class 2.1: an improved package manager, proper hashes, and lots of Ruby 1.9 goodness

Having managed to go the weekend without making any more fiddly changes to it, I’m finally pushing JS.Class 2.1 out of its Git repo and into the real world. The major updates in this release are a Hash implementation, a much-improved package manager that runs on server-side platforms, and lots of updates taken from Ruby 1.9. The full summary:

  • New libraries: ConstantScope, Hash and HashSet, a much faster Set implementation.
  • The package manager has been improved with a new API, parallel downloading of files, and support for server-side environments such as SpiderMonkey, Rhino and V8. It also supports user-defined loader functions for transparent integration with Google and Yahoo!’s packaging systems.
  • The Enumerable module has been updated with plenty of methods from Ruby 1.9, and now supports enumerators, and Symbol#to_proc-like functionality whereby a string, MethodChain or any object that implements toFunction() can be used as an iterator.
  • The core object methods now live in Kernel, and we’ve added new methods: tap(), equals(), hash() and enumFor().
  • The double inclusion problem is now fixed; no current Ruby implementation seems to support this properly.
  • Ancestor and method lookups are now cached so callSuper runs about twice as fast.
  • Classes can be named to generate displayName on methods for use with the WebKit debugger.

You can download it from the website, and you’ll no doubt be pleased to know I finally compiled a changelog for the project and will be including it with releases from now on.

If you’ve enjoyed this article, you might enjoy my recently published book JavaScript Testing Recipes. It’s full of simple techniques for writing modular, maintainable JavaScript apps in the browser and on the server.