Category:CoffeeScript: Difference between revisions

m
<lang> -> <syntaxhighlight>
(This looks like wholesale copy from the Wikipedia page. Please fix!)
m (<lang> -> <syntaxhighlight>)
 
(6 intermediate revisions by 6 users not shown)
Line 1:
{{language|
{{language}}{{{wikipedia}}}'''CoffeeScript''' is a programming language that compiles to [[:Category:JavaScript|JavaScript]]. The language adds syntactic sugar inspired by [[:Category:Ruby|Ruby]] and [[:Category:Python|Python]] to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching.
site=http://coffeescript.org
}}
{{language}}{{{wikipedia}|CoffeeScript}}'''CoffeeScript''' is a programming language that compiles to [[:Category:JavaScript|JavaScript]]. The language adds syntactic sugar inspired by [[:Category:Ruby|Ruby]] and [[:Category:Python|Python]] to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching.
 
With 8964000+ watchers and 68300+ forks (as of NovemberDecember 10, 20102011), CoffeeScript is ranked as one of the "most interesting" projects on Github. [http://github.com/repositories] The language has a relatively large following in the Ruby community, and has been used in production by [http://thinkvitamin.com/mobile/new-rails-like-framework-from-37signals-for-html5-mobile-apps/ 37signals]. There haveRuby beenon reportsRails thatbegan officialto support forinclude CoffeeScript will be included in theits nextasset pointpipeline releasein ofRails Rubyversion on Rails3.1 (see [http://www.hagenburgerrubyinside.net/TALKScom/rails-3.-1-frontendadopts-performancecoffeescript-jquery-sass-and-controversy-4669.html]).
 
== History ==
On December 13, 2009, Jeremy Ashkenas made the first git commit of CoffeeScript with the comment: "Initial commit of the mystery language." The compiler was written in Ruby. On December 24th, he made the first tagged and documented release, 0.1.0. On February 21, 2010, he committed version 0.5, which replaced the Ruby compiler with one written in pure CoffeeScript. By that time the project had attracted several other contributors on Github, and was receiving over 300 page hits per day.
 
On December 24, 2010, Ashkenas announced the release of stable 1.0.0.
As of November 2010, the language is still changing rapidly. According to CoffeeScript.org, it will become more stable when version 1.0 is released. Ashkenas has stated that the next release will be dubbed 0.9.9, and that he plans to make the 1.0 release before December 25th. [http://github.com/jashkenas/coffee-script/issues/830]
 
== Examples ==
Line 12 ⟶ 15:
A common JavaScript snippet using the jQuery library is
 
<langsyntaxhighlight lang="javascript">
$(document).ready(function() {
// Initialization code goes here
});
</syntaxhighlight>
</lang>
or even shorter,
<syntaxhighlight lang="javascript">
$(function() {
// Initialization code goes here
});
</syntaxhighlight>
 
In CoffeeScript, the <code>function</code> keyword is replaced by the <code>-></code> symbol, and indentation is used instead of curly braces (except when defining an [[associative array]]), as in Python. Also, parentheses can usually be omitted. Thus, the CoffeeScript equivalent of the snippet above is
 
<!-- Ruby is probably the most similar language that GeSHi supports -->
<langsyntaxhighlight lang="ruby">
$(document).ready ->
# Initialization code goes here
</syntaxhighlight>
</lang>
or
<syntaxhighlight lang="ruby">
$ ->
# Initialization code goes here
</syntaxhighlight>
 
== Compiling ==
Line 38 ⟶ 52:
 
== External links ==
* [http://coffeescript.org CoffeeScript.org] - Official site]
* [http://github.com/jashkenas/coffee-script/ GitHub repository]
* [http://twitter.com/coffeescript @CoffeeScript] - Twitter feed
3,021

edits