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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Why I switched from Ruby to Go

132 点作者 poissonpie超过 11 年前

19 条评论

kitsune_超过 11 年前
I&#x27;m looking forward to all the &quot;Why I switched from Go to XXX&quot; posts in three years.<p>Same thing will probably happen to node.js pretty soon. It has already been happening to MongoDB for quite some time.<p>Go is currently in its hype phase.<p>Some people seem to make a living by writing post-mortems.<p>Why does everything always have to be the latest and greatest thing on earth?<p>Can&#x27;t we just institutionalize the hype cycle? Like fashion, minus the seasons? One big show every year where everyone can compare their dicks and then let&#x27;s shut up about it until next year?
评论 #6732146 未加载
评论 #6731699 未加载
评论 #6731632 未加载
评论 #6731753 未加载
评论 #6731661 未加载
评论 #6732517 未加载
评论 #6732174 未加载
评论 #6731987 未加载
评论 #6731986 未加载
评论 #6732252 未加载
评论 #6731674 未加载
评论 #6731824 未加载
评论 #6733416 未加载
评论 #6732269 未加载
评论 #6731763 未加载
评论 #6733971 未加载
adrianoconnor超过 11 年前
The title of the post is &quot;On Distributing Command Line Applications: Why I Switched From Ruby to Go&quot;, which changes the sentiment somewhat. The guy who wrote the post is clearly happy to choose the right tool for the job. The sensational title here looks silly.<p>Anywaay Go looks like a good solution for what he&#x27;s doing. I tried distributing a Ruby-based app years ago (maybe around 2008 or 2009) with a pre-compiled version of Ruby for Windows bundled as part of my programme. The Nullsoft installer package I wrote took ages to write all of those .rb files (that make up the standard lib). It sort of worked OK, but the project didn&#x27;t go anywhere -- that was probably lucky -- it&#x27;d have been a nightmare to maintain.
joaomsa超过 11 年前
One approach I&#x27;ve seen for portable Ruby apps is to use JRuby. You gain the ability to package your code as a standalone, compiled java app for distribution. From that it becomes as simple as running &#x27;java -jar app.jar&#x27; or use a similar transparent stub executable.<p>Granted now you&#x27;ve just punted the problem of Ruby version to JVM version (which I&#x27;ve found to be less of a hassle) but at least took care of the nightmarish management of gem dependencies without something like bundler.
评论 #6731803 未加载
评论 #6733803 未加载
评论 #6731892 未加载
evilduck超过 11 年前
As a Ruby guy, one thing off putting to me is that what appears to be &quot;idiomatic Go&quot; involves naming things as tersely as possible. Most Go code I look at has maybe-usefully named types or interfaces and then they usually go and assign them to something utterly meaningless like &#x27;t&#x27;, &#x27;vt&#x27; and so on.<p>Go&#x27;s official docs and standard libraries seem to reinforce this style choice, and most 3rd party code follows this general C++ style inspiration too. I know I can do what I like in code that I would write, but it seems like I&#x27;d be swimming against the current.
评论 #6733437 未加载
评论 #6733542 未加载
评论 #6733677 未加载
评论 #6736729 未加载
评论 #6733557 未加载
16s超过 11 年前
This is the same reason I re-wrote a lot of my Python code in C++ many years ago. Distributing one self-contained, statically linked executable just works and even the most clueless user can download and run it.<p>But I <i>still</i> use a lot of Python and I&#x27;m sure this guy still uses a lot of Ruby. Everything has its place.
评论 #6733250 未加载
h2s超过 11 年前
Couldn&#x27;t agree more. I made the mistake of using Ruby to build a CLI application too, and distribution is a massive hassle. At the moment I&#x27;m still at the awkward stage of distribution via Rubygems which the article advises strongly against, and I&#x27;d add &quot;Gem startup time cripples your performance&quot; to the article&#x27;s point about Rubygems being difficult for non-Rubyists.
评论 #6731642 未加载
评论 #6731617 未加载
评论 #6735760 未加载
masklinn超过 11 年前
So... wouldn&#x27;t <i>any</i> language which allows building statically linked executable be suitable for TFA&#x27;s issue[0]? Or even just a more reliable version of py2app or py2exe-style bundling?<p>[0] Ada, OCaml, Haskell, Rust, ATS if you&#x27;re really perverted?
评论 #6732742 未加载
vidarh超过 11 年前
I love Ruby, and use it a lot, but I have to agree with him about distribution. It&#x27;s one of the reasons I am slowly plodding along on my ruby compiler (though at my current rate it&#x27;s still a couple of years away from being useful) - I want static executables.<p>If I wanted to distribute a Ruby app to non-Rubyists today, I&#x27;d likely end up packaging up the Ruby interpreter of my choice and all dependencies in a single archive rather than trust a sane environment on the users machine.<p>And that obviously limits the type of situations you&#x27;d want to use it substantially. For my part it&#x27;s not really an issue, because of what I&#x27;m using it for, though.
eliot_sykes超过 11 年前
tl;dr: Distributing command line apps is awkward when they are written in Ruby, so you&#x27;re better off using Go. The author has created a library to help write CLI apps in Go [1] and gives an example of how to use it.<p>[1] <a href="https://github.com/codegangsta/cli" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;codegangsta&#x2F;cli</a>
dodyg超过 11 年前
This is why enterprise tends to be very conservative and stick to one or two platforms for decades. It&#x27;s stupid to throw away your investments when your tech du jour ran out of its time.
评论 #6731914 未加载
shortlived超过 11 年前
How come no mention of rb2exe and things of that nature? Are they not viable options? (Haven&#x27;t used ruby in years but when I did above mentioned solution was the way to go)
评论 #6731618 未加载
solarexplorer超过 11 年前
Previous discussion: <a href="https://news.ycombinator.com/item?id=6083231" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6083231</a>
vorbote超过 11 年前
Hmm... There is a basic misuse of terms here. The author uses the term &quot;distributing applications&quot; but he is actually talking about <i>application deployment</i>. Oh well, language evolves and most of the times becomes murkier.<p>But I do agree. There is a in inherent higher barrier of entry when you force your users to install third-party libraries or even your deliverable from an outside (&quot;fourth-party&quot;?) distribution source. Be it ruby gems, CPAN, Pypy, cabal, whatever.
评论 #6732102 未加载
评论 #6732015 未加载
code_scrapping超过 11 年前
If we put aside the ego-bashing and dick-measuring, the good side of hyping-out a technology would be to find it&#x27;s limitations.<p>So, the articles will slowly turn from &quot;why X is great&quot; to &quot;I don&#x27;t want to move to X because...&quot;, but the meta-message is that you get a survey of tool usage.<p>Always look on a bright side of hype, tu-dum, tu-dum-tu-dum-tu-dum.
steeve超过 11 年前
Speaking of distribution, cross compilation on Go is really, really easy and awesome.<p>And for those who want to do cross compilation _with CGO_, it&#x27;s definitely possible and I put a little tutorial to do it: <a href="https://gist.github.com/steeve/6905542" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;steeve&#x2F;6905542</a>
camus2超过 11 年前
live by the hype , die by the hype. That and the fact that the ruby&#x2F;rails community is full of egocentric hipsters that like to take a shot at each other,other languages, and say &quot;f*ck&quot; too often...<p>The problem is now these hipsters are moving to nodejs so that community has exactly the same problem too.<p>Go community,while little, is more like python&#x27;s, mature,respectful(most of the time),that&#x27;s important on the long run,to build a community around positive and cosntructive thinking.<p>NodeJS will burn itself like rails if it goes on that way.
评论 #6733504 未加载
caiob超过 11 年前
def hype_switch from_lang, to_lang &#x27;Why I switched from #{from_lang} to #{to_lang}.&quot; end
voodoomagicman超过 11 年前
does anyone know what the library he is using is in the example ruby code?
finishingmove超过 11 年前
Code Gangsta (certified) !!!<p>Fuck. Yeah.