Subscribe to Who needs shades of grey?        RSS Feed
-----

CoffeeScript

Icon 7 Comments
It's snowing, and I'm on my nth cup of coffee, and I'm going to talk a little bit about Coffee Script. Full disclosure: I found out about this from a post someone made a while ago over on Forrst but that's not the right place for a rambling blog post.

I've been meaning to try CoffeeScript out for a while now, and since I've started a new, mostly-straight-html website for a client I figured it was a good chance to leap in. I haven't got very far yet, but I'm hopeful. A potentially interesting thread just started up asking Do We Need More Programming Languages? but it hasn't got a lot of momentum yet.

CoffeeScript is a new language, of sorts, and then again it's an old language. It interests me. And nobody else is talking about it here. It's a syntactic re-write of javascript. Confused? No need, just read the blurb. In short, it takes a syntax more similar to Python than much else, and compiles it to javascript. So it'll work in any browser, just like JS. It'll work with frameworks, like jQuery. It'll work with anything that uses javascript - you just have to remember to compile it and not let your cow-orkers make changes to the JS files when you're on holiday.
Because it compiles to JS, it doesn't have the problem of needing popular support. You don't have to use it. If it disappears from view, in five years someone can simply delete it, look instead at the JS it produces and work from that.

Syntax-wise, well, I love me a bit of Python these days. I like the way CS takes the best of that awesome language and the best of JS. Example code looks extremely clean and readable. Obviously, that's cherry-picked for the website, but the potential is there.

I'm saying all this, but I haven't compiled anything yet. I'm just psyched by the idea. If it plays out, I might even do some sort of tutorial. If not... I'll deny everything.

7 Comments On This Entry

Page 1 of 1

Amrykid Icon

30 November 2010 - 06:24 AM
After taking a quick look at the syntax, it looks fun. Good Luck learning it and I hope to see some tutorials.
0

Dormilich Icon

30 November 2010 - 07:43 AM
I wonder if CoffeeScript supports Events
0

heyoman1 Icon

30 November 2010 - 08:09 PM
CoffeeScript was made with that "make your own programming language" pdf thing. Just a tid-bit of info. :)
0

moopet Icon

01 December 2010 - 02:01 AM

heyoman1, on 01 December 2010 - 02:09 AM, said:

CoffeeScript was made with that "make your own programming language" pdf thing. Just a tid-bit of info. :)


What's that when it's at home?
0

Munawwar Icon

01 December 2010 - 08:23 AM
Nice. Syntax wise this is better than those Java-to-Javascript compilers - Rhino and GWT. I fear that I will forget JS with a tool/language like this.
A side thing: css too got a syntactic re-write with sass.
0

moopet Icon

01 December 2010 - 09:49 AM

Munawwar, on 01 December 2010 - 02:23 PM, said:

Nice. Syntax wise this is better than those Java-to-Javascript compilers - Rhino and GWT. I fear that I will forget JS with a tool/language like this.
A side thing: css too got a syntactic re-write with sass.

I've seen a few compiled CSS ideas and apart from a quick hack I did in PHP I'd always felt they kinda sucked. Sass looks pretty good! I never thought I'd feel excited about getting myself further away from the code.
0

NickDMax Icon

01 December 2010 - 03:04 PM
Well my immediate question is: What does jQuery look like in CoffeeScript? It is obviously possible but is it functional from a syntax prospective.

the one thing I really don't like about jQuery is the appreance of the word "function" and brace-parenthesis-semicolon nests (I noticed that many jQuery developers leave off unneeded semicolons but that drives me nuts).

So if I can find ways to simplify having to write:
$('td:odd').each(function() { console.log($(this).text()); });
I am all for it. I love jQuery selectors but the overall javascript syntax begins to get on my nerves.

. o O (There is probably an easier way to express the above line of code I just needed an example of jQuery syntax.)
0
Page 1 of 1

October 2014

S M T W T F S
   1234
567891011
12131415161718
192021222324 25
262728293031 

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)