Live data from Hacker News

CoffeeScript: The beautiful way to write JavaScript

amix.dk

1–10 of 88 posts

Re: CoffeeScript: The beautiful way to write JavaScript

#3
I've had trouble learning CoffeeScript due to the compiler not providing any help whatsoever when you make a mistake.

I was writing a web server that just wouldn't compile, looked the code over several times and eventually gave up and did it in javascript instead. Later found out that Gedit was displaying a tab that vim showed as just being a space. Never tested if that was the only problem or not.

Re: CoffeeScript: The beautiful way to write JavaScript

#4
I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue.

I understand that syntax may be more convenient for some, but this is indirection, and is a source of complexity that may impede collaboration from other devs more familiar with JavaScript.

Re: CoffeeScript: The beautiful way to write JavaScript

#5
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

CoffeeScript is javascript so prototypal objects still work as expected. They just went ahead and threw in classes if you want them, since there are already many javascript libraries that provide them for people who either are used to / want classes or to make it easier to port existing code.

Re: CoffeeScript: The beautiful way to write JavaScript

#6

I've had trouble learning CoffeeScript due to the compiler not providing any help whatsoever when you make a mistake. I was writing a web server that just wouldn't compile, looked the code over several times and eventually gave up and did it in javascript instead. Later found out that Gedit was displaying a tab that vim showed as just being a space. Never tested if that was the only problem or not.

Agreed. The compiler definitely isn't as helpful as it could be in giving information about errors. On the other hand, a lot of the errors it hits at compile-time are things you wouldn't have noticed until run-time if you were writing JavaScript.

Re: CoffeeScript: The beautiful way to write JavaScript

#7
I really wanted to like CoffeeScript but that it can't be metaprogrammed and serialized (easily) is a huge problem for a scripting language. I guess scripting was never the point of CoffeeScript, but a lot of what makes JavaScript so flexible is lost when you add a compile stage.

Re: CoffeeScript: The beautiful way to write JavaScript

#8
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

Perhaps this isn't the best forum for such a philosophical debate, but the notion that because you have prototypes in JavaScript you don't have classes is just plain wrong.

Every single time you see JavaScript prototypes used effectively, you'll find that they follow a classical pattern: A constructor function serves as the class object from which new objects are instantiated. Syntax like instanceof ("object instanceof class") gives this away. So do all of the built-in JavaScript classes: String, Function, RegExp, Number...

If it's an abstract object that defines common properties for instances, it's a class object, regardless of what you choose to call it. JS prototypes just expose the implementation mechanism, and CoffeeScript just provides you with a convenient way to manipulate the prototype chain.

Re: CoffeeScript: The beautiful way to write JavaScript

#9
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

I'm personally of the opinion that prototype-based systems are superior to class-based systems in exactly the same way that gotos are superior to for loops.

Add to this the fact that JavaScript's prototype system isn't actually very flexible, and you're almost always better off to roll a class-based system on top of it.

Re: CoffeeScript: The beautiful way to write JavaScript

#10
I would love to see javascript turn into assembly language. Google has already done with with GWT with great improvements in productivity.

One question I had while reading this. Was there a technical reason why he didn't make a gem or toolkit in pure Ruby or Python that would then spit out Javascript?

I think this is closer to how GWT did it where you can write pure Java, and of course it then wouldn't require people to learn a new language.

Post reply on HN