TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Farewell CoffeeScript

75 pointsby staltzover 10 years ago

18 comments

mmahemoffover 10 years ago
This is like a lot of &quot;religious&quot; language comparisons. It&#x27;s written by someone who is intimately familiar with one and (appears to be) fleetingly familiar with the other.<p>The author makes some odd assumptions about CoffeeScript&#x27;s intentions, ie language reduction and protecting against &quot;evil code&quot;. All of this ignores the real main benefit, which is cleaner syntax, which means less finger typing and easier comprehension of a large and complex code base.<p>There was a time when JavaScript was the only real choice for browser-based web development. There were compilation tools like GWT, but they were heavyweight and generated the JavaScript equivalent of binary, completely detached from the source code. Now that the JavaScript++ languages are here (CoffeeScript, TypeScript) and well-supported in the browser thanks to source maps, I find it hard to imagine why people continue using raw JavaScript with all the bloated keywords, curly braces, etc (apart from legacy code bases). Usually it&#x27;s because they haven&#x27;t used anything else, and are content to focus on the negative of Coffee etc and stick to what they already know.
评论 #8400283 未加载
评论 #8400128 未加载
评论 #8400415 未加载
LBarretover 10 years ago
So this is a kind of teenage hubris thing ? In which other field this would be normal ? I play the devil&#x27;s advocate there, but please bear with me : IMHO, this attitude is among the causes of the high failure rates of many projects (personnal or pro).<p>The constraints are minor, the gains of coffeescript quite clear. There is no important gains in sight that justify moving to js. So why changing ?<p>Changing for the sake of change, is silly and something all of us do. A successful project needs as much technical stability as feature stability.
评论 #8399963 未加载
评论 #8399931 未加载
评论 #8399984 未加载
评论 #8400062 未加载
tincoover 10 years ago
Ungrateful 4 year old, he&#x27;ll back before supper. If Ruby raised you well, I know python is a bit of a sloppy father though its heart is in the right place and he brings home the bacon, you&#x27;ll know it&#x27;s not just about the 5% code reduction. It&#x27;s about abstracting away the inconsistencies of the language, revealing its inner elegance and power. CoffeeScript is not a cloak to hide JavaScript, it&#x27;s the suit that makes you see and respect its power.
jeswinover 10 years ago
I recently migrated a fairly large CoffeeScript project to JS, after using CS for more than three years. ES6 and ES7 addresses many of the pain points of JS right now. So my sugggestion would be to use an ES6&#x2F;ES7 transpiler instead of CoffeeScript.<p>- JS produced by the CS compiler isn&#x27;t that great, to be honest.<p>- Plain JS is easier to debug than CS, even though you have source maps.<p>- Source map chains don&#x27;t always work. So using CoffeeScript together with another tool which produces its own source maps could be a problem.<p>- Build time could go down without CS<p>- Way more devs understand JS than CS<p>- I might have considered sticking with CoffeeScript if it had plans to evolve, perhaps add more functional features. But jashkenas considers CoffeeScript mostly done. As michaelficarra mentions in <a href="https://github.com/jashkenas/coffeescript/issues/3073" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jashkenas&#x2F;coffeescript&#x2F;issues&#x2F;3073</a>, &quot;CoffeeScript needs to evolve or die&quot;<p>- When ES6 gets implemented, just get rid of the ES6&#x2F;ES7 transpiler and you have plain JS<p>I haven&#x27;t read the article, but if you ask me CoffeeScript is dying.
ankoover 10 years ago
I wish there was a bit more to the explanation, like examples of the naming issues listed.<p>I&#x27;ve found that coffeescript prevents whole classes of bugs, and makes lots of javascript warts nicer to live with.<p>For example, you don&#x27;t seem to run into scope issues, and it&#x27;s a lot easier to bind this to what you expect.<p>5% more code (if it really amounts to that) is still more code, too! No code is like no code.
评论 #8399878 未加载
评论 #8399833 未加载
评论 #8399834 未加载
mdavidnover 10 years ago
Without CoffeeScript, automated JavaScript linters are your friend. Run them in your editor, test suites, and asset pipelines. They&#x27;ll catch those pesky &quot;var&quot; and &quot;===&quot; typos.<p><a href="http://www.jshint.com/docs/" rel="nofollow">http:&#x2F;&#x2F;www.jshint.com&#x2F;docs&#x2F;</a>
评论 #8399886 未加载
评论 #8399862 未加载
评论 #8399835 未加载
resca79over 10 years ago
&quot;Also, in the end of the day, your generated JavaScript is just about 5% more verbose than actual CoffeeScript code, so I don&#x27;t see real benefit.&quot;<p>I disagree with this sentence.<p>Anyone use coffeescript only to reduce the code verbosity, maybe wrong.<p>It&#x27;s a simple evolution of thejavascript language that currently has an old syntax. Do not confuse old syntax with popularity and power of the language itself.<p>Many programmers have figured out that readability and clarity code are a good stuff, especially looking forward if the project will become big and much complex.<p>It&#x27;s why Swift or Rust were created, not why their code is less verbose of Objective-c or C, but because they have a clear syntax, and it helps programmers in their productivity.
dasil003over 10 years ago
JavaScript is a wonderful place to sow your wild oats and create your own object-orientation schemes, its prototypal inheritance is wonderfully powerful and fun to play with.<p>However when you get to building non-trivial systems with javascript you need to pick a style and stick with it. In that regard you can do much worse than CoffeeScript.
galfarragemover 10 years ago
If I could choose I would choose Ruby over Javascript ANY DAY (I am not saying that is better, just that sintax is easier to pick for an hobbyist as me).<p>But I can&#x27;t. JS is everywhere and I don&#x27;t have time to learn several programming languages.<p>CoffeeScript was a way to make JS more enjoyable to me. You can say that CoffeeScript is still another language to learn but once that is related to JS, you learn both simultaneously, killing two birds with one stone.
评论 #8400601 未加载
chealdover 10 years ago
I&#x27;m not quite sure what the point of this is. A scan of the diff doesn&#x27;t reveal anything particularly interesting being done in Javascript that Coffeescript would get in the way of. It&#x27;s fine to argue that Coffeescript gets in your way and prevents you from doing things that you couldn&#x27;t do otherwise, but at least demonstrate examples to that effect.<p>Even more perplexingly, there are methods like `merge` in examples.coffee&#x2F;js which, in the Javascript version, are effectively compiled Coffeescript, and which are less concise than they should be; why does the Javascript version call `Array.prototype.slice.call(arguments)` when arguments is never treated as an array outside of length and subscripting, both of which the arguments object already supports? Coffeescript does it specifically so that using arguments as an array is transparent to the user. Why is it necessary in the Javascript version, when the only effect is the creation of an additional object?<p>It&#x27;s somewhat silly to argue for Javascript on the basis of it offering finer control over the code, and then not using that control. If you just don&#x27;t like Coffeescript, fine, but let that be your argument.
pmontraover 10 years ago
Despite their share of problems (the author explained what&#x27;s wrong with CoffeScript in his opinion), languages compiled to JS will keep flourishing unless some future ESx will turn it into a more conventional language. Even in that case, being the native language of the &quot;internet virtual machine&quot;, people wanting to use a language-X-look-alike for the front end will keep designing their transpilers.<p>In my case I never considered CoffeScript because of the indentation&#x2F;semantic spaces thing. I had to work with those languages sometimes and the troubles I had when moving blocks of code around and copy&#x2F;pasting examples from the net have been enough to undo any gains from a cleaner syntax (assuming it is cleaner). No Python either here, obviously, nor HAML or SLIM for templating. Irony: they&#x27;ve been invented in the Ruby community which somewhat prides itself of using a language with a better syntax than Python (I second that, Python looks too much like a C with defs which is maybe the reason for its success: familiarity.)
评论 #8400390 未加载
pjmlpover 10 years ago
I never got the point of all these alternative languages.<p>I rather use the real thing without any extra layers.
评论 #8399860 未加载
评论 #8400050 未加载
评论 #8400084 未加载
bayesianhorseover 10 years ago
Coffeescript is just a short-hand for best practices javascript. It enhances readability and consciseness.<p>But nothing more. Bad (or neutral) practice is still possible in coffeescript. Mixing coffeescript and javascript files is easy. Classes can be defined any way you please (if you don&#x27;t mind using something other than the &quot;class&quot; keyword).<p>I think the only reason for me to switch to something else from coffeescript is if some similar language where to get a nicer type system exactly right. I&#x27;m not holding my breath though.
datashamanover 10 years ago
Purescript FTW! :)
pawelkomarnickiover 10 years ago
Meh, he doesn&#x27;t like Coffeescript, who cares? Why all the fanfares and huge deal? :-)
MaybiusStripover 10 years ago
Programming language wars over languages that have significant differences are often silly, the whole coffeescript vs JS debate is just ludicrous.
kra34over 10 years ago
That&#x27;s crazy talk, next thing you&#x27;ll be saying we don&#x27;t need AngularJS to make web applications.
danabramovover 10 years ago
RX is awesome by the way.