TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

CoffeeScript: JavaScript without the Fail (slides)

131 点作者 TrevorBurnham超过 13 年前

16 条评论

jameskilton超过 13 年前
To be fair, one shouldn't bash Brendan, he had to build the initial JavaScript language in a week[1]. It's not his fault the language became the defacto web-language.<p>[1]<a href="http://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/#comment-1021" rel="nofollow">http://www.jwz.org/blog/2010/10/every-day-i-learn-something-...</a>
评论 #2979826 未加载
评论 #2980274 未加载
评论 #2981288 未加载
评论 #2980296 未加载
评论 #2981052 未加载
thezilch超过 13 年前
Every time I'm left unconvinced, either by pointy-edged syntax or not fair representations of javascript...<p>Arrays could use a beard or the varied language syntax is going to cause ingrown pains:<p><pre><code> Declaring arrays In CoffeeScript: things_that_rule = [ "robot unicorns" "honey badgers" "Lord Inglip" ] Destructuring assignment Assign variables from inside arrays: sum_and_difference = (a, b) -&#62; [a + b, a - b] [sum, difference] = sum_and_difference 5, 2 </code></pre> It's also bizarre from a Python background:<p><pre><code> &#62;&#62;&#62; [ ... "a" ... "b" ... "c" ... ] ['abc'] </code></pre> =====<p><pre><code> if foo.bar? then console.log foo.bar # if (foo.bar != null) { ... } </code></pre> versus<p><pre><code> if(foo.bar){console.log(foo.bar);}</code></pre>
评论 #2980117 未加载
评论 #2980121 未加载
CJefferson超过 13 年前
Out of interest, how does coffeescript scale, and can it start to get unreadable?<p>I worry the compression, while cute, could start to get a little extreme after a while, for example:<p>class Shape<p><pre><code> constructor: (@x, @y) -&#62; centre: -&#62; [ @x, @y ] area: -&#62; 0 </code></pre> is starting to look close to unreadable and overcompressed (in particular, the constructor implicitly declaring member variables).<p>Also having a quick look through the bug reports, there seems to be some interesting inconsistencies, such as:<p>x for x in [1,2,3] # x == 3<p>x for x in [1..3] # x == 4<p>I also see a complaint that:<p>foo bar: 'baz', quux('onoz')<p>Won't parse. I understand this should parse as:<p>foo({bar:'baz'}, quux('onoz'))<p>Both of these, and other little things I've seen, make me think coffeescript is more of a giant bag of good ideas, rather than a well-thought out language. In particular, is there a clear unambiguous grammar for it anywhere? I can't find one.
评论 #2980213 未加载
评论 #2980332 未加载
评论 #2980494 未加载
评论 #2980149 未加载
评论 #2981264 未加载
评论 #2980955 未加载
josteink超过 13 年前
I hope this submission doesn't signal an era of meme-worship here on Hacker News. "Fail" may just be borderline, but it sure triggers my radar.<p>The flood of memes slid slowly in the back-door at reddit, one innocent step at a time. Questioning this often got you the comment that you were old, stiff and lacked the funny-gene. Time passed and look at what a worthless trollhole reddit eventually became.<p>I hope to see fewer submissions like this on HN in the future.
lightcatcher超过 13 年前
Does anyone else prefer the syntax of javascript to that of coffee script? Really, my only problems with javascript are no multi-line strings and type coercion (but type coercion issues are mitigated by always using ===). Otherwise, I think javascript is a fine language. Also, the with statement isn't that bad in my opinion.
评论 #2980618 未加载
评论 #2980613 未加载
wccrawford超过 13 年前
The slides you can type in are quite annoying. I didn't find any way to continue other than clicking with my mouse.
评论 #2979922 未加载
评论 #2980019 未加载
评论 #2979892 未加载
评论 #2979833 未加载
评论 #2979986 未加载
seanalltogether超过 13 年前
The Hyperbole is strong with this one
rjd超过 13 年前
Am I the only one who is amused by the irony of these guys?<p>i.e. "lets use Javascript end to end", and then the very same people go and create a new language to replace said Javascript?
评论 #2980302 未加载
tjholowaychuk超过 13 年前
There's still plenty of fail, just different kinds of fail.
harel超过 13 年前
Perhaps I'm missing the point here, but I don't get why there's such a hype over CoffeeScript. People seem to prefer learning a brand new language in order to avoid getting proficient in another language they already (should) know. Or in other words, people prefer to learn a language that will code another language for them. Its like I'll go and learn Japanese just so I can use it to write phonetic English.
评论 #2981308 未加载
artursapek超过 13 年前
The beard slide made me laugh, but it doesn't hold any water. Ryan Dahl is clean-shaven in the node.js intro video on their website. Also, I think Javascript is great. Its 'bloated' syntax makes for minimize-able files which can end up being half the size of the originals. That's just a preference thing.
评论 #2980159 未加载
samgro超过 13 年前
I love the facial hair theory. LOL.
评论 #2979920 未加载
评论 #2981248 未加载
评论 #2981268 未加载
reustle超过 13 年前
What's with the biased JS examples in the beginning?
samrat超过 13 年前
Will I be able to use Coffeescript with frameworks like Node.js? If yes, then how so?
评论 #2981181 未加载
评论 #2981177 未加载
minikomi超过 13 年前
Sorry if I'm late to the game but I have to say I started using vim-coffeescript with coffeecompile on watch mode and it's wonderful. It's basically like the window on the homepage but in vim.
yannis超过 13 年前
Why are the slides not using coffeescript?