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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

One Night With Clojure Makes a Scala Guy Humble | Agile Zone

83 点作者 rohshall将近 13 年前

8 条评论

Uchikoma将近 13 年前
Some years ago I wrote "Is Java 10x more verbose than Python (LOC)? A modest empiric approach" [1]. The most interesting comment quoted "PROGRAMMING LANGUAGES ARE LIKE GIRLFRIENDS: THE NEW ONE IS BETTER BECAUSE <i>YOU</i> ARE BETTER"from [2].<p>[1] <a href="http://codemonkeyism.com/comparing-java-and-python-is-java-10x-more-verbose-than-python-loc-a-modest-empiric-approach/" rel="nofollow">http://codemonkeyism.com/comparing-java-and-python-is-java-1...</a><p>[2] <a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html" rel="nofollow">http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_swit...</a>
评论 #4413886 未加载
lmm将近 13 年前
As they say on another part of the internet, "pics or it didn't happen". For an example this short it would be so easy to show the code, and see how much the scala version could actually be improved.<p>The programming languages shootout has clojure down as a bit larger than scala for the same benchmarks: <a href="http://shootout.alioth.debian.org/u32/which-language-is-best.php?calc=chart&#38;scala=on&#38;clojure=on&#38;xfullcpu=0&#38;xmem=0&#38;xloc=1&#38;nbody=1&#38;fannkuchredux=1&#38;meteor=1&#38;fasta=1&#38;fastaredux=1&#38;spectralnorm=1&#38;revcomp=1&#38;mandelbrot=1&#38;knucleotide=1&#38;regexdna=1&#38;pidigits=1&#38;chameneosredux=1&#38;threadring=1&#38;binarytreesredux=1&#38;binarytrees=1" rel="nofollow">http://shootout.alioth.debian.org/u32/which-language-is-best...</a>
评论 #4412523 未加载
hxa7241将近 13 年前
The program get shorter because the author learned more and improved it each time, not mainly because of the languages.<p>Mainstream programming languages do not seem to vary much in lines of code of programs: the range is maybe about 2 or 3. Here is evidence: <a href="http://www.hxa.name/minilight/#comparison" rel="nofollow">http://www.hxa.name/minilight/#comparison</a><p>This stands to reason. Look at everyday languages: they all have the same features -- they are perhaps surprisingly similar in basic structure. Control-flow, operations, data-primitives, data-compounds -- all are very similar. One of the more outlying is C: lacking common higher-level amenities like exceptions, nice data-structures, and particularly storage management, can expand code significantly.
评论 #4413357 未加载
评论 #4413153 未加载
评论 #4413551 未加载
seertaak将近 13 年前
A 10x reduction from Java-&#62;Clojure is IMHO suspicious. A ~2-3x reduction I would (just about) believe.<p>It's possible that some of the improvement came from having solved the same problem for the third time.
评论 #4412171 未加载
djhworld将近 13 年前
My only problem with Clojure is the terrible JVM start up time.<p>While I agree that for typical long running applications like web servers/web applications this isn't really an issue, the problem manifests itself when you want to write small scripts or small command line applications that have similar performance to their Java equivalent.<p>If you write a CLI app in Java, the application will execute almost instantly as soon as you run it, but with languages like Clojure/Scala you have to wait a long time.
评论 #4412896 未加载
评论 #4412553 未加载
评论 #4414915 未加载
PaulHoule将近 13 年前
The damning point against Scala there is that the Scala program is only about 30% the length of Java.<p>That's not enough savings to make up for the complexity of a language that seems like an unholy union of Perl, C++ and F#.<p>For me the breakthrough in Scala was understanding enough about how it works that I could interface with Scala code easily in Java. At that point I could copy any of those patterns in Java. They were a little more verbose than Scala, but more reliable because I wasn't worrying that some piece of magic was going to cause something extraordinary to happen.
评论 #4413358 未加载
评论 #4413547 未加载
评论 #4414449 未加载
评论 #4413037 未加载
vineet将近 13 年前
I like what Clojure is trying to do, but comparing languages based purely on LOC is crazy.<p>Its almost like choosing one car over another because the first one looks better even if it does not have an engine.<p>At the end of the day, languages help you write code. Comparisons on how much time it would take to write the code would be much closer to usefulness and would be interesting (even though they would have also have their own challenges).<p>This would be a really hard test to do in the real world, but I would like to see the code generated by 2 teams over a year - each having 4-5 people and each having similar experiences (ideally 10 years of coding background).
评论 #4413413 未加载
评论 #4413561 未加载
Uchikoma将近 13 年前
1.) K [1] is shorter than Clojure, if LOC is a metric you love. 2.) Scala 8x more LOC than Clojure, I'm not believing this.<p>Or in other words, show some code.<p>[1] <a href="http://en.wikipedia.org/wiki/K_(programming_language)" rel="nofollow">http://en.wikipedia.org/wiki/K_(programming_language)</a>
评论 #4441629 未加载