[web-devel] richer client experiences

Greg Weber greg at gregweber.info
Wed Jan 26 17:07:12 CET 2011


Thanks for the great extra info on JMacro. I think haskellers would enjoy
hearing about it and how you use it as a blog post.

Hi! Author of JMacro here. You're right that JMacro has a few less

features than CoffeeScript. In particular, it lacks pattern matching.

Outside of that, however, most CoffeeScript features are to make

CoffeeScript more rubylike in syntax. Haskell-style anonymous lambdas

coupled with whitespace function application on their own, however,

suffice to allow exceedingly Haskell/ML-like code. JMacro can be used

as a nicer syntax for JavaScript, but the big win is that it is a

better way to *generate* JavaScript -- in particular via hygiene and a

shared namespace with surrounding Haskell code. So bear in mind also

that JMacro syntax is infinitely-extensible in the sense that you can

not only write JavaScript combinators in JMacro, but Haskell

combinators which produce JMacro that can be spliced directly back

into a block of code. Jeff and I have, for instance, written a tiny

set of infix combinators for chaining jQuery selectors.


coffee-script isn't designed to give javascript a ruby-like syntax. It is
designed to add useful language level features and get rid of superfluous
syntax, which Ruby and haskell also try to do. Maintaining a certain amount
of javascript compatibility makes it look more like Ruby and less like
Haskell. But there are definitely influences from other languages. For
example, it uses layout syntax instead of an 'end' keyword (or brackets) in
ruby. You can use groovy's existential operator.



More information about the web-devel mailing list