Live data from Hacker News

Why CoffeeScript Isn't the Answer

walkercoderanger.com

71–80 of 148 posts

Re: Why CoffeeScript Isn't the Answer

#71

Sometimes I think that most CoffeeScript, ClojureScript, etc. programmers are people who were advanced in other languages before they learned JavaScript. There are quite a few programmers who have no issues with these "bad parts" or "really bad parts" because they cut their teeth on them, and these numbers are growing: Most people now learn JavaScript as their first language. JavaScript already won, and things like C…

I disagree with this. This implies that you always view your first language through rose colored glasses. I don't think this is the case. Anectodally, I learned C first and still use it to this day, but I can certainly tell you where its flaws are and when I would and would not use it.

Yes, a beginner might not see the flaws of Javascript up front, but given enough time to become an expert, they certainly will.

Re: Why CoffeeScript Isn't the Answer

#72

Ok, so if CoffeeScript is just JavaScript, add the parenthesis. If you need brackets to make a section of code readable or compile to "certain" JavaScript, then add them. Even the programs I work on we add parenthesis, brackets, etc for readability. Use CoffeeScript to increase productivity. Nowhere does CoffeeScript say you must use white space instead of brackets and such. Keep it simple and easy, classes are also…

There are still two sides in programming, it seems. And interestingly enough it's not necessarily static vs. dynamic or procedural vs functional. One the one hand you have pragmatic, loosey goosey languages like perl, javascript, ruby, even scala and C#. An important defining characteristic being perl's maxim "there's more than one way to do it". On the other hand you have what I'd call the "bondage and discipline" l…

It's not that simple if you go beyond surface impressions and common usage. There are in fact many ways to do the same thing in Java and Python, some better than others. Both languages have escape hatches that can be used to extend the language; it just requires more effort.

Reflection and annotation processors in Java are very powerful tools; see Guice, Dagger, and AutoValue. Creating something like JQuery is awkward in Java, but it can be done; see GQuery. Java 8 will make functional and callback-heavy DSL's a whole lot easier to build.

Python may look like a strict language but it's not. You can redefine just about anything except the core syntax. If you want to make your head spin look into metaclass programming.

Haskell is a weird one; statically typed, but extremely expressive. It's very easy for Haskell programmers to define their own obscure notations and like when reading mathematics, you must understand the definition of every symbol or you're lost.

One interesting dimension is the attitude towards modifying other people's libraries. In Java, it's easy to build something that nobody else can change unless they fork the library and modify the source or mess with the bytecode. But if you build your own, you can do what you want. In more dynamic languages, you can load someone else's library and muck with it at runtime.

Re: Why CoffeeScript Isn't the Answer

#73
post #15

delayed: () -> -> this.model # isn't the class Well, that isn't really fair now, is it? You could have used the fat arrow (`=>`) for binding `this` to the class. With that in mind, I agree with the author in that CoffeeScript isn't the answer, at least not exactly. With syntax this incredibly similar, how far are we from compiling python (with generators, with statements, imports, ...) to JavaScript?

>how far are we from compiling python I frankly find CoffeeScript nicer than Python. There are advantages and disadvantages, obviously, but whenever I'm writing Python, it makes me long for CoffeeScript.

Going from CoffeeScript to Python (bundled together with going from Node.js to Python) is painful. So many things that CoffeeScript has learned over Python - of all of them, "everything is an expression" rule.

Re: Why CoffeeScript Isn't the Answer

#75

This article proves not that CoffeeScript is flawed but that Jeff Walker doesn't understand how to use it. For instance, his first example is: # BROKEN func 5, { event: (e) -> if e.something 36 else 45, val: 10} Anyone with more than a day's experience with CoffeeScript knows that it's much better to express this with the simpler: # far better func 5, event: (e) -> if e.something 36 else 45 val: 10 Note how just drop…

The argument that "you just don't understand" can excuse any flaw in anything. If someone can reasonably choose to formulate something, and for that formulation to pass static verification but do something totally unexpected, the language is at fault, not the author.

The point is it doesn't pass static verification. It doesn't compile. It's a rather silly thing for the author to argue imho.

Re: Why CoffeeScript Isn't the Answer

#76

Sometimes I think that most CoffeeScript, ClojureScript, etc. programmers are people who were advanced in other languages before they learned JavaScript. There are quite a few programmers who have no issues with these "bad parts" or "really bad parts" because they cut their teeth on them, and these numbers are growing: Most people now learn JavaScript as their first language. JavaScript already won, and things like C…

I disagree with this. This implies that you always view your first language through rose colored glasses. I don't think this is the case. Anectodally, I learned C first and still use it to this day, but I can certainly tell you where its flaws are and when I would and would not use it. Yes, a beginner might not see the flaws of Javascript up front, but given enough time to become an expert, they certainly will.

[deleted]

Re: Why CoffeeScript Isn't the Answer

#77
My problem with CoffeeScript has always been the syntax vs. semantics issue. CoffeeScript saw a big opportunity to improve JavaScript semantics and help programmers more easily avoid the JavaScript minefield ("var" and "===" for example), but in doing so decided "while we're at it, let's overhaul the general syntax too".

Gratuitously changing "function" to "->" for no reason other than removing characters seems to introduce more brand new idiosyncrasies than it's worth. If the goal were to improve JavaScript as a language by smoothing over a few of the gotchas, which of course would require a few syntax updates, then I think it would be immensely valuable. (Think SCSS instead of the original "Sass".) But it seems as if the authors were more troubled that JavaScript didn't write like Ruby, so they made a new language that happens to compile to JavaScript. And now I have two languages to choose from, each with pros and cons and their own gotchas, adding more complexity to my decisions when I was hoping for simplification.

Re: Why CoffeeScript Isn't the Answer

#79

My problem with CoffeeScript has always been the syntax vs. semantics issue. CoffeeScript saw a big opportunity to improve JavaScript semantics and help programmers more easily avoid the JavaScript minefield ("var" and "===" for example), but in doing so decided "while we're at it, let's overhaul the general syntax too". Gratuitously changing "function" to "->" for no reason other than removing characters seems to in…

> Gratuitously changing "function" to "->" for no reason other than removing characters seems to introduce more brand new idiosyncrasies than it's worth.

What idiosynchrasies are you referring to here? Just curious. I love the stabby lambda (for the exact reason you listed, because I am defining functions on every other line).

Re: Why CoffeeScript Isn't the Answer

#80
post #74

[deleted]

Nice reply!

One little thing I disagree: Syntax is important. A language is an interface for a low level context, and since it's an interface, it does have UX. Syntax is a big part of the UX of a language.

And it's no me that is saying this, it's Crockford: https://www.youtube.com/watch?v=_EANG8ZZbRs

Post reply on HN