n******7 发帖数: 12463 | 1 我的理解是
golang就是个带GC,concurrncy很容易的C
另外编译快,deploy方便
据说golang吸引了很多python programmer, 我也算是一个吧
不过大部分好处都是有代价的,很多缺点要实际用才能感受
作为只写过golang hello world的人,看了下面一个总结决定不值得学习
最关键的是前两条:
Hard to abstract even the simplest notions
Designed to make the programmer expendable
第二条对java之类的可能也适用,但是java的抽象级别还是高了很多,也就是说经验技
巧还是很有用的
Con
Hard to abstract even the simplest notions
Go is famously regarded as very simple. However, this simplicity becomes
problematic in time. Programmers who use Go find themselves over and over
again writing the same thing from a very low point of view. Domains not
already served by libraries that are easy to glue are very difficult to get
into.
Con
Designed to make the programmer expendable
Go was designed for large team projects where many contributors may be
incompetent. That Go can still get things done under these conditions is a
testament to its utility in this niche. Go's infamously weak abstraction
power is thus a feature, not a bug, meant to prevent your teammates from
doing too much damage. This also means any team member can be easily
replaced by another code monkey at minimum cost. Good for the company, bad
for you. The more talented programmers, on the other hand, will be very
frustrated by having one hand tied behind their back.
Con
Expects prior familiarity with tooling, "advanced" OS use
A standard step of even installing Go is modifying your path -- a person who
's encountering their first language might not even understand. It's hard to
escape using Go without familiarity with using build tools, managing and
organizing project directories, etc. It's not as simple as Python's "just
run the .py file with the interpreter."
Con
Requires specific directory structure and environment variable settings
Too much knowledge required for a first programming language.
Con
Implementation of interfaces are difficult to figure out
Finding out what interfaces are implemented by a struct requires a magic
crystal ball. They are easy to write, but difficult to read and trawl
through.
Con
Performance slowdown because of indirect calls and garbage collection
Practically no meaningful Go application can be written without indirect
function calls and garbage collection, these are central to Go's core
infrastructure. But these are major impediments to achieving good
performance.
Con
Does not support circular dependencies
Con
Easy to shadow variable
Due to single character only difference, declare and assign statement can
easily shadow variable from outer scope unconsciously. Example:
err := nil
if xxx {
err := somefunctionthatreturnsanerr
}
return err // always return nil
Con
Weak type system |
n******7 发帖数: 12463 | 2 上面总结来自
https://www.slant.co/versus/126/5522/~golang_vs_rust
另外看到一个不错的评论,感觉我被说服了
https://www.quora.com/How-do-Rust-and-Go-compare-1/answer/Tikhon-Jelvis?srid
=29sY
"The other often-touted, and eminently reasonable advantage Go gives is the
fast compile time. But this just means that other languages' compilers do
more for you. I think my time is worth more than my computer's time; I would
want my compiler to do as much optimization as possible. Hell, you can just
turn the optimization off when you're developing and get reasonable compile
times with the alternatives (like GHC)." |
a9 发帖数: 21638 | 3 其实关键还是库支持程度,现在go也有很多开源好库了,虽然我还没用过go,但觉得有
点前途
srid
the
would
just
compile
【在 n******7 的大作中提到】 : 上面总结来自 : https://www.slant.co/versus/126/5522/~golang_vs_rust : 另外看到一个不错的评论,感觉我被说服了 : https://www.quora.com/How-do-Rust-and-Go-compare-1/answer/Tikhon-Jelvis?srid : =29sY : "The other often-touted, and eminently reasonable advantage Go gives is the : fast compile time. But this just means that other languages' compilers do : more for you. I think my time is worth more than my computer's time; I would : want my compiler to do as much optimization as possible. Hell, you can just : turn the optimization off when you're developing and get reasonable compile
|
n****l 发帖数: 1739 | 4 Con
Hard to abstract even the simplest notions
這個有點誇大其詞了。 看過太多的太空架構師,寫得Java和C#code基本是shit, 一層
包一層
的abstraction。 這個就是golang最大的好處,因爲你不會和這些idiots做同事。 |
n******7 发帖数: 12463 | 5 问题是论库java c# python之类的只会更多
为啥用go?
【在 a9 的大作中提到】 : 其实关键还是库支持程度,现在go也有很多开源好库了,虽然我还没用过go,但觉得有 : 点前途 : : srid : the : would : just : compile
|
s********k 发帖数: 6180 | 6 Hard to abstract even the simplest notions?
不觉得啊,用interface吧
【在 n******7 的大作中提到】 : 我的理解是 : golang就是个带GC,concurrncy很容易的C : 另外编译快,deploy方便 : 据说golang吸引了很多python programmer, 我也算是一个吧 : 不过大部分好处都是有代价的,很多缺点要实际用才能感受 : 作为只写过golang hello world的人,看了下面一个总结决定不值得学习 : 最关键的是前两条: : Hard to abstract even the simplest notions : Designed to make the programmer expendable : 第二条对java之类的可能也适用,但是java的抽象级别还是高了很多,也就是说经验技
|
f*******t 发帖数: 7549 | 7 太对了
【在 n****l 的大作中提到】 : Con : Hard to abstract even the simplest notions : 這個有點誇大其詞了。 看過太多的太空架構師,寫得Java和C#code基本是shit, 一層 : 包一層 : 的abstraction。 這個就是golang最大的好處,因爲你不會和這些idiots做同事。
|
d****n 发帖数: 1637 | 8 Con
Does not support circular dependencies
我孤陋寡闻了。哪个优秀的语言这么搞? |
d****n 发帖数: 1637 | 9 Con
Does not support circular dependencies
我孤陋寡闻了。哪个优秀的语言这么搞? |
w********m 发帖数: 1137 | 10 agree
选择语言其实是选择队友的问题。
【在 n****l 的大作中提到】 : Con : Hard to abstract even the simplest notions : 這個有點誇大其詞了。 看過太多的太空架構師,寫得Java和C#code基本是shit, 一層 : 包一層 : 的abstraction。 這個就是golang最大的好處,因爲你不會和這些idiots做同事。
|
|
|
S*A 发帖数: 7142 | 11 python 就可以 GC circular dependencies。
【在 d****n 的大作中提到】 : Con : Does not support circular dependencies : 我孤陋寡闻了。哪个优秀的语言这么搞?
|
m*****n 发帖数: 3575 | 12 怎么搞的?说说看?
【在 S*A 的大作中提到】 : python 就可以 GC circular dependencies。
|
S*A 发帖数: 7142 | 13 我以为,
这个就是 graph reachable 的问题。
你从程序 local 和 global 开始往下扫描。
扫到的 mark, 从 heap 过一遍就可以清除没有扫描的。
这个是我自己乱想的啊。
这个循环依赖的清除 C 编译器里面也有。大概就是类似
这样的算法。
【在 m*****n 的大作中提到】 : 怎么搞的?说说看?
|
d*******o 发帖数: 493 | 14 golang最大的feature就是禁止circular dependency,然后无限线程compile。
所以compile的速度秒杀其他语言。
要是这是个bug的话,那我只好呵呵了。 |
m*****n 发帖数: 3575 | 15 我知道的circular dependency就是两个函数或者两个模块可以互相访问?
在python里这么搞是无效的
所以为了能够让母子模块之间共享变量,我都只好再开一个模块放全局变量
【在 S*A 的大作中提到】 : 我以为, : 这个就是 graph reachable 的问题。 : 你从程序 local 和 global 开始往下扫描。 : 扫到的 mark, 从 heap 过一遍就可以清除没有扫描的。 : 这个是我自己乱想的啊。 : 这个循环依赖的清除 C 编译器里面也有。大概就是类似 : 这样的算法。
|