Why do you use golang?

agolangf · · 750 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I do because c got most things right but it doesn&#39;t scale for the web. Also I find that the use of for loops rather than map or fold leads to less boiler plate and more portable code. The conncurency support is great and having Google to back us is amazing!</p> <hr/>**评论:**<br/><br/>Bromlife: <pre><p>Doesn&#39;t scale for the web? What does that even mean? One should not say &#34;web scale&#34; unless one is being ironic.</p> <p>I use Go because I find it pleasurable to code in &amp; after struggling with both Python&#39;s &amp; Node&#39;s frustratingly bad implementations of concurrency, goroutines was a breath of fresh air.</p></pre>aagee: <pre><p>Can you expand on your struggle with Python, and how you found Go to be better?</p> <p>I am picking up Go (and I come from a C/C++/C#/Python background) - and finding it hard to see why it is a &#34;good&#34; language. Some of the syntax makes me cringe. Maybe I need to keep at it for a while.</p></pre>Simpfally: <pre><p>Which syntax makes you cringe?</p></pre>afrobee: <pre><p>Like everything? Also not generics ofcourse</p></pre>aagee: <pre><p>Well, for one thing, the way switch is overloaded of use as normal switch and a type switch. And in the type switch, the cases are actually types, and the value being switched on is the value (not type).</p> <pre><code>switch v := anything.(type) { case string: fmt.Println(v) case int32, int64: fmt.Println(v) case SomeCustomType: fmt.Println(v) default: fmt.Println(&#34;unknown&#34;) } </code></pre> <p>Then there is the part:</p> <pre><code>anything.(type) --and-- anything.(someType) </code></pre> <p>These seem to be two different things, but use the same syntax. And what is the intuition behind this syntax anyways? There is already someType(anything). What does the &#34;.&#34; in &#34;anything.(someType)&#34; signify (in that the &#34;.&#34; is used for member access)?</p> <p>I have other things. But let me hear your views on the above.</p></pre>Simpfally: <pre><p>Well x.(T) is a <a href="https://golang.org/ref/spec#Type_assertions" rel="nofollow">type assertion</a> and (T)x is a <a href="https://golang.org/ref/spec#Conversions" rel="nofollow">conversion</a></p> <p>I&#39;m not an expert so I can&#39;t tell you <em>why</em> they did it that way.</p> <p>And if you don&#39;t like overloading, there&#39;s also channel switches.</p> <p>I feel like there&#39;s not a lot of keywords or particular syntax in general, so maybe x.(T) isn&#39;t intuitive but it&#39;s easy to use and remember so yeah.</p></pre>PM_ME_YOUR_VIMRC: <pre><p>But go is web scale isn&#39;t it? </p></pre>Bromlife: <pre><p>Please explain to me what &#34;web scale&#34; means.</p></pre>Simpfally: <pre><p>trolls</p></pre>PM_ME_YOUR_VIMRC: <pre><p>I was told on hn that golang is webscale maybe I got trolled there.</p></pre>Simpfally: <pre><p><a href="/r/gobashing" rel="nofollow">/r/gobashing</a> is leaking :)</p></pre>PM_ME_YOUR_VIMRC: <pre><p>What that sub is disgusting go 4 lyfe</p></pre>PM_ME_YOUR_VIMRC: <pre><p>Concurrent and a mogodb driver</p></pre>mrcactus28: <pre><blockquote> <p>c got most things right</p> </blockquote> <p>wut</p></pre>PM_ME_YOUR_VIMRC: <pre><p>Its simple</p></pre>gianhut: <pre><p>I thought Simplicity<sup>TM</sup> NoGenerics<sup>TM</sup> was trademarked by Rob Pike and the Golang team though?</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

750 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传