CoffeeScript brewing as variation on JavaScript

The open source project, still in the alpha stage, reflects what JavaScript could look like with a syntax to match its features

CoffeeScript, billed by its creator as "unfancy JavaScript," is in development as a language that compiles into JavaScript but offers a different sense of style.

Still in an alpha stage of development, CoffeeScript offers array comprehensions similar to Python and makes JavaScript statements viable as expressions, said Jeremy Ashkenas, who recently began developing CoffeeScript and put out an updated version designated as release 0.2.0 on Monday evening.  Documentation on the 0.2.0 releasee can be found at this Web page. But CoffeeScript, which is open source, is not recommended now for use in deploying applications, given its newness.

[ Also in the software development realm, a beta release of Ruby on Rails 3 is anticipated later this month. ]

"I'm not suggested that anyone use it for real projects at this point," Ashkenas said. "The language is still changing a good deal."  Potential uses, though, could include Web development or server-side JavaScript development.

"The basic idea is that JavaScript has a really nice sort of core object model and a really nice object-oriented model and functional nature," Ashkenas said. "But a lot of that is hidden behind its syntax, which it gets from Java, mostly."

"The problem with that is the syntax doesn't match the core concepts in the language," and is not as elegant or useful as the concepts are, he said.  CoffeeScript reflects what JavaScript could look like with a syntax to match its features, said Ashkenas, who, aside from working on CoffeeScript,  is lead developer at DocumentCloud.

Featuring a compiler written in Ruby, CoffeeScript does not add any special methods or objects but compiles directly into vanilla JavaScript, he said.

The language tries to make JavaScript capabilities, such as function literals, for describing a function, easier. Lexical scoping, for handling local variables, is featured as well.

"Basically, in CoffeeScript you can't accidentally great a variable," Ashkenas said. This feature provides for stronger security.

A Python-style whitespace capability is featured in version 0.2.0 for closing spaces. Version 0.2.0 also features object comprehensions, for looping over properties of an array or object and deriving a comprehension based on them.

This story, "CoffeeScript brewing as variation on JavaScript," was originally published at InfoWorld.com. Follow the latest developments in application development at InfoWorld.com.

Join the PC World newsletter!

Error: Please check your email address.

Tags javascript

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Paul Krill

InfoWorld
Show Comments

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?