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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Golang Sucks

3 点作者 one2three4超过 3 年前

2 条评论

daviddever23box超过 3 年前
Somehow the rest of us manage to get quite useful work done in Go.<p>What’s your daily driver?
one2three4超过 3 年前
Honestly the only real argument I&#x27;ve heard for Golang is that it is &quot;coming from Google so it must be good&quot;. Every time I&#x27;ve tried to write in this language it feels like I&#x27;m hitting my head with a hammer.<p>Google might have very smart and knowledgeable people in it but this language is like a bad overhyped C. See next code that all it is doing is parsing a CSV line:<p>func NewPoint(line string) *Point {<p>tokens := strings.Split(line, &quot;,&quot;)<p>if len(tokens) != 4 {<p><pre><code> return nil } var err error p := new(Point) </code></pre> &#x2F;&#x2F; why cannot I declare and assign err in one go??<p>p.id_ride, err = strconv.Atoi(tokens[0])<p>if err != nil {<p><pre><code> return nil } p.lat, err = strconv.ParseFloat(tokens[1], 32) if err != nil { return nil } p.ts, err = strconv.ParseInt(tokens[2], 10, 64) if err != nil { return nil } return p </code></pre> }<p>most of the code has nothing to do with its functionality - it&#x27;s just error handling that is plain hideous to write and read. Not to mention all the clutter to just convert an integer and a float.<p>And let&#x27;s just not go into deeper aspects such as the structs that double as classes and has everyone creating his own style of SOLID and DPs. Or the inconsistent syntax which sometimes looks like traditional OO and othertimes like plain C further confusing users.<p>I find it very hard to believe that this language would have caught on if it weren&#x27;t for Google pushing for it so aggressively. And I find it so disheartening to realise that after all these years developer productivity and happiness is merely an afterthought for language designers and that marketing and hype are the main drivers.<p>And yes I know the saying &quot;there are languages people complain about and languages that people do not use&quot;. I find it worthy of high school gotcha sayings to which I reply that language designers of the majority of programming languages have no clue about how to make a language nice to its users. It&#x27;s as they know how to design a internal combustion engine and then they put a chair and 4 wheels on it and they dismiss complaints about how unreasonably difficult and miserable the driver experience is.
评论 #29124115 未加载