Friday, June 12th, 2009

JS.Class 2.1 released

Category: JavaScript, Ruby

<>p>James Coglan has updated JS.Class, his implementation of Ruby’s object system in JavaScript.

This release includes a Hash implementation, HashSet, an updated Ruby 1.9 Enumerable module with enumerators and Symbol#to_proc functionality, and an improved package loader that supports parallel downloads and runs on SpiderMonkey, Rhino and V8.

Detailed Changes

  • 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.

Related Content:

Posted by Dion Almaer at 6:37 am
9 Comments

+++--
3.1 rating from 23 votes

9 Comments »

Comments feed TrackBack URI

w00t! This rocks!!! Nice work! :^D

Comment by constantology — June 12, 2009

Guys I have the perfekt idea. IE6 support is all about statistics. If the usage goes below 5% or so even bosses will say, letz ignore the IE6.

All we have to do is, grab a list of 100.000.000 kinda important websites or so. Write a tool which will give clients a chunk of 100 websites, to access for a couple of minutes each and in a few days, with enough Web Developer IE8 pcs. Every statistic of these 100.000.000 websites will have a lot of IE8 PIs and hopefully a very tiny percentage of IE6 access. (Like Seti, could work as Screensaver)

Something like a DDoS attack, BUT with a better background idea. :D

Save a web dev.

Comment by Aimos — June 12, 2009

Ya I am sorry there is already like a ton of libraries which do the same type of thing. Personally I would rather use JSAN for modules and Joose for classes. Besides isn’t prototype supposed to make JavaScript like Ruby already? I mean if the community could agree on a single interpreter of Ruby in JavaScript then we would be much closer to solving that problem.

I am sorry I just don’t like the fact that there is so much overlap and reinventing the wheel and this is just another case of a person who decided to do everything himself I mean this doesn’t seem to reuse anything. It is well written and highly documented though.

Comment by jhuni — June 13, 2009

how is this better than using protoclass.js? when i do a little firbeug profiling it becomes clear that the majority of burned cycles is done within one of the protoclass facilities. that, in a physics engine, which *should* spend a lot of time in actual computation, not in code organization beaurocratics. simply: u need a tool to organize your javascript—true, coz js is so atrocius. u need someone to slow your javascript to a crawl—false, coz javascript already is slowed to a crawl, by the browser. i stopped believing in oop some time ago anyhow, so this news is old.

Comment by loveencounterflow — June 13, 2009

If it works alright, it could be just what the doctor ordered for me.

As I write more Javascript, I am getting to the point of wanting to run more of it both at the client-side and on the server-side and the fact that this library is tested with V8 and Rhino etc does tease me to look at it further. I currently use PrototypeJS and its OO support but I have been thinking about even trying to move Prototype’s OO into an independent library but then I do not want to have totally unique code written using it in the world. ;-)

This library’s purposes seem cool, but I am not too sure either… Let’s wait and see. And this is from a Rubyist and Javascripter who is just a tad tired right now, trying to keep his email and news reader in check after days of letting them loose. ;-)

Comment by jpedrosa — June 13, 2009

How does this compare with Joose? Has anyone used them both?

Comment by Nosredna — June 13, 2009

there’s a load of spam hidden in the HTML of this article…

Comment by kae — June 14, 2009

Here’s a screen grab of the spam:

http://papernapkin.org/pastebin/resource/images/imageEntryId/5680

Comment by ddjohnson — June 14, 2009

Spam is distributed with RSS. Got a virus in your WordPress?

Comment by elazutkin — June 15, 2009

Leave a comment

You must be logged in to post a comment.