Brewing CoffeeScript as variation on JavaScript

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.

 

“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 create 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.

Would you recommend this article?

Share

Thanks for taking the time to let us know what you think of this article!
We'd love to hear your opinion about this or any other story you read in our publication.


Jim Love, Chief Content Officer, IT World Canada

Featured Download

Featured Articles

Cybersecurity in 2024: Priorities and challenges for Canadian organizations 

By Derek Manky As predictions for 2024 point to the continued expansion...

Survey shows generative AI is a top priority for Canadian corporate leaders.

Leaders are devoting significant budget to generative AI for 2024 Canadian corporate...

Related Tech News

Tech Jobs

Our experienced team of journalists and bloggers bring you engaging in-depth interviews, videos and content targeted to IT professionals and line-of-business executives.

Tech Companies Hiring Right Now