161 points · by protez · 15y ago · 38 comments
I followed up with the following free e-book, which I highly recommend:
Smooth CoffeeScript
I've always wondered why they made coffee-script syntax so close to ruby without going all the way. "Write javascript in ruby" would have been a killer feature and tagline, but instead we're 80% of the way there with occasional expectations still being broken and new quirks to learn. Anyway...still a huge improvement overall so don't want to sound negative. Just something I was curious about.
That someone who knows javascript can so trivially pick up coffeescript says a lot about why they chose the syntax they did.
http://en.wikipedia.org/wiki/Function_(mathematics)#Notation
I think that's probably the source (perhaps indirect) of CS's function notation. Personally I think it's far more intuitive than JavaScript's, if you start out knowing neither language.
I started looking into making a parser that took CoffeeScript and parsed it into PHP, and the farther I got spec'ing things out, the less the CoffeeScript syntax made sense for the context of PHP. So it would make more sense to start new, and create a new syntax that fits better. I'm assuming the same process may have occurred for CoffeeScript.
Anyways, as someone who greatly prefers Python over Ruby, I love using whitespace for blocks.
https://github.com/jashkenas/coffee-script/wiki/List-of-lang...
The point of CoffeeScript is something quite different. It's an attempt to tidy up JS semantics, while finding a minimalist syntax to express the "good parts" of JavaScript. Any similarities to Ruby, Python, Haskell, Perl, Potion, etc. are hopefully only present in places where they make sense on the merits, and not just to be similar for familiarity's sake.
jQuery.tmpl is unmaintained, slow, and very broken. It may be worth changing the example.
However, I just tried taking one of your html files and converting it directly to epub (again, using calibre, which is free)..and it did a pretty good job.
I think if you can merge the chapters together and spend a bit of time tweaking it, you'll end up with a nice ebook.
ebook-convert ebook.txt ebook.epub --formatting-type markdown
or you can use the UI.Calibre also comes bundled with a bunch of command line tools which, in my opinion, are much nicer than Calibre itself.
Coffeescript has a different syntax than javascript, and it is totally pointless to say "you don't need to type 'var'". It would be better to talk about how scoping works in coffescript.
It happens that everything that's been written about coffeescript so far is about convincing javascript users to switch or helping javascript users to switch. That's not the only way.
The links point to URL's though.
Considering that JS is one of the most ubiquitous and popular languages today this is kind of a big deal.
Do you have specific criticisms of CoffeeScript? That would probably have made for a more productive comment.