Friday, November 21st, 2008

Ejacs: Why you would want to a JS runtime in Emacs Lisp

Category: JavaScript

I had to hold this back until Friday, because you will need some time to read Steve Yegge talking about his new project Ejacs:

Ejacs is an Ecma-262 compliant JavaScript interpreter written entirely in Emacs Lisp. It should work in GNU Emacs versions 22 and higher.

The parser and evaluator are ports of Brendan Eich’s Narcissus (JavaScript in JavaScript). The runtime is my own implementation, with a few exceptions (notably the regular expression engine) that are ports of Mozilla Rhino code.

The post is true Steve-y. He rambles and loops in the way that Billy Connolly does in a standup routine, somehow managing to hold on to enough string to get his way back. Take some time to read the beast in full, but here is my translation:

  • Steve talks about playing guitar
  • He then mentions Ejacs
  • He talks about Narcissus the cheater
  • Reading the ECMA-262 specification is a lot of fun
  • Holy crap he had to learn a lot of elisp
  • Emacs has arbitrary-precision mathematics, deep Unicode support, rich Date and Calendar support, and an extensive, fairly complete operating system interface.
  • All that for a “text editor” huh. Oh, it is a platform.
  • js2-mode came first
  • Rewrite it by porting Mozilla Rhino’s parser, which is (only) about 2500 lines of Java code. Ejacs is something like 12,000 lines of Emacs-Lisp code, all told, so that didn’t seem like a big deal.
  • JavaScript is better than elisp? Blashphemous
  • Problem #1: Momentum
  • Problem #2: No encapsulation
  • Problem #3: No delegation
  • Problem #4: Properties
  • Problem #5: No polymorphic toString
  • Emacs advantages: Macros and S-expressions
  • That said, I suspect I would probably prefer Clojure over Rhino, if I ever get a chance to sit down with the durn thing and use it, so it’s not so much “JavaScript vs. Lisp” as it is vs. Emacs Lisp.

Posted by Dion Almaer at 9:31 am

3.5 rating from 15 votes


Comments feed TrackBack URI

hah. thanks for the cliffnotes. his blog posts are pretty entertaining.

Comment by ilazarte — November 21, 2008

Ejacs? really? that might take the cake for worst name ever.

Comment by DarrenKopp — November 21, 2008

I dont know for the other people, but in my native language (french), the name of that is really awkward….

Comment by olivvv — November 21, 2008

“Ejacs: Why you would want to a JS runtime in Emacs Lisp”
Syntax error line 1 Char 28: object is not an object

Comment by TNO — November 21, 2008

Lol, very very funny names for people who can understand french … Lots of french are twisted/perverse mind like me :)

So please choose another name for your framework !


Comment by dxd — November 21, 2008

Google the name you want to use for your application, game, library, etc. If you find porn links as the #1 result, I would not use that. LOL
Honest boss, I am looking for answers on this JavaScript library. I am not searching for porn!

Comment by epascarello — November 22, 2008

People always say that js=c+lisp, I think it is true without any doubt.

Comment by KKFC — November 23, 2008

A javascript interpreter done in elisp – apparently just for a bit of geeky self pleasure … I don’t know maybe the name is not in-approriate, in that context.

Given that he picked the name when a reader told him not to call it ejax – I think he’s in on the joke.

Comment by Allen — November 24, 2008

Leave a comment

You must be logged in to post a comment.