Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are various tools that aiming to make <a href="http://coffeescript.org/" rel="noreferrer" title="CoffeeScript">CoffeeScript</a> usable with <a href="https://developers.google.com/closure/" rel="noreferrer" title="Google Closure Tools">Google Closure Tools</a>. I will describe three of them:</p> <h2>Bolinfest's CoffeeScript fork</h2> <p>Features:</p> <ul> <li>Fixed function binding, loops, comprehensions, <code>in</code> operator and various other incompatibilities</li> <li>Fixed classes syntax for Google Closure</li> <li>Automatic generation of <code>@constructor</code> and <code>@extends</code> annotations</li> <li>Automatically inserts <code>goog.provide</code> statement for each class declared</li> <li>Python's like <code>include namespace as alias</code> support translated to <code>goog.require</code> and <code>goog.scope</code></li> </ul> <p>Drawbacks:</p> <ul> <li>Constructor has to be the very first statement in the class</li> <li>Cannot use short aliases for classes inside the class (i.e. class <code>My.Long.Named.Car</code> cannot be refered as <code>Car</code> in class definition as pure CoffeeScript allows)</li> <li>User written JsDoc comments don't get merged with compiler generated ones</li> <li>Missing <code>provide</code> equivalent for <code>include</code></li> <li>No support for type casting, this can be done only by inserting pure javascript code inside backticks "`"</li> <li>Based on outdated CoffeeScript 1.0</li> </ul> <p>Read more at <a href="http://bolinfest.com/coffee/" rel="noreferrer">http://bolinfest.com/coffee/</a></p> <h2>My CoffeeScript fork</h2> <p><strong>Disclaimer: I am the author of this solution</strong></p> <p>This solution is inspired by the Bolinfest's work and extends it in these ways:</p> <ul> <li>Constructor can be placed anywhere inside the class</li> <li>Short aliases for classes work using <code>goog.scope</code></li> <li>User written JsDoc comments get merged with compiler generated, user written <code>@constructor</code> and <code>@extends</code> annotations are replaced by generated</li> <li>Each namespace is provided or included mostly once, namespace, that is provided is never included. You can provide namespace by keyword <code>provide</code></li> <li>Support for typecasting using <code>cast&lt;typeToCastTo&gt;(valueToBeCast)</code> syntax</li> <li>Based on CoffeeScript 1.6</li> </ul> <p>Read more at <a href="https://github.com/hleumas/coffee-script/wiki" rel="noreferrer">https://github.com/hleumas/coffee-script/wiki</a></p> <h2>Steida's Coffee2Closure</h2> <p>Unlike the two solutions above, Steida's Coffee2Closure is postprocessor of javascript code generated by upstream nontweaked CoffeeScript. This approach has a one major advantage, that it will need no or only slight updates with continued development of CoffeeScript and still be actual. However, by the very nature of this approach, some of the features cannot be delivered. Currently it fixes only classes and bindings, loops, <code>in</code> operator and few other incompatibilities. It has no support for automatic annotation generation, type casting or custom keywords.</p> <p><a href="https://github.com/Steida/coffee2closure" rel="noreferrer">https://github.com/Steida/coffee2closure</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload