Sublime Text Editor and CoffeeScript

If you use Sublime Text Editor, there are a couple of nice plugins that will help you along your journey.
sublime-better-coffeescript is a fork of the original Sublime CoffeeScript plugin. It provides you “syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.”

sublime coffeescript

Watched compilation
Most of the features, you take for granted, but the interesting feature for me is the watched compilation. This means that if you save a CoffeeScript file, it will automatically compile it to JavaScript for you. This has been pretty handy when you start learning CoffeeScript.

Just write some CoffeeScript, save it, and check out what JavaScript is compiled. It sheds some insight on the syntax when you are just starting to learn CoffeeScript.

CoffeeScript, day 2

Day 2 of learning CoffeeScript. It’s a short day today, but I learned a couple of things.

The Good

Same name key-value pairs in defining JSON

When you are defining JSON, there is some shorthand available to you when the name of the key is the same name as the variable for the value of the key.

is the equivalent to:

The Bad

Soaks

My initial reaction to soaks is…ugh. Syntactic sugar is one thing, this just feels like it can be easily abused or make the code harder to read. So what is a soak?

A soak is a special case of the existential operator.
For example:

This code means, set a equal to b (if b exists), else set it to c.

A soak is a chainable existential operator where as far as i can tell whitespace also matters. Suppose you want to set a equal to the name property of b if it exists, else set it to c. In JavaScript, something like that would look like:

but if you use soaks, you can shorten it to: