由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 珍惜生命,远离 R 和 Go
相关主题
两个我永远都不想碰的语言写惯了C++ code,再写C code真不习惯
python 本来就是个烂语言,早晚崩盘。Python Q: function pass in struct pointer, come back with data filled
C到底能走多远。。。。。。Java终于要支持primitive type的generic了
Why C++11 introduce "decltype" and "auto"?access violation of C# in Visual Studio 2013 (转载)
typedef 的一个问题C++中size_type怎么处理?
http://golang.org/ 你们都是hello 世界吗?code swarm (video)
Golang的promise lib哪个好?[合集] 弱问:C++ 里的Vector在Java里用什么替代比较好?
From C++ to Cplease help C++ beginner
相关话题的讨论汇总
话题: go话题: nil话题: struct话题: type话题: println
进入Programming版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
最近无聊,稍微研究了下两个语言,彻底被惊呆了。
第一是 R 。可以说是世界上最 fucked up 的语言之一(COBOL 是另外一个)。
你看一下这篇文章就明白了:
https://xianblog.wordpress.com/2010/09/13/simply-start-over-and-build-
something-
better/
第二就是 Go 。整个一傻逼语言。
1) 如果该语言有 pointer,但是其速度比 Java 还慢点,谁 TMD 有毛病才用它。
再不用说,Go 里面需要知道很多很多 low level 的东西,但是搞了半天比 Java
还慢?!!
2) Stupid copies 。好吧,你有 pointer 不用,非得 pass by value (i.e.
struct copy),真是脑袋抽筋了。copy 大部分情况下比 reference 慢。
reference 是可以放在 register 里的,而 struct 一旦比 register 大,
就会占内存。然后 Go idiots 说 cache 很 precious,那你还搞那么多 copy
干嘛?这么多 copy,debug 成了问题。C/C++ debugging 常用的 watch r/w
办法彻底被废了。到目前为止,Go 的 debug 也是主要靠 printf 。
3) 为了保证 pass by reference ,有些代码还特意就是
type dumb struct {
wtf * pointer
}
真是什么样的傻逼语言才产生这种怪胎。如果该 struct 是 pass by reference,
该 struct 又得放在 heap 上。真是有够无聊。
4) 傻逼的 error handling 。Exception 是慢,但是 Go 的 error handling
整个一个失败。如果某人大意了没读 error return,该 error 就彻底消失,
这就是一个大 bug,而且是很难 trace 的一个问题。你如果每一个 function
call 都读一下 error,整个屏幕上 50-75% 的代码都是 error handling 。
更不用说,return multiple value 也不快。
写 Java 的人都知道,Java 的 exception 对 debugging 帮助很大。Go lang
有 panic / recover,但是太原始了。Go 对 debugging 的忽视本身就是致命
的。
5) 没有 generics 。一个没有 generics 的语言根本没资格谈论 type safety 。
6) 傻逼的 map, array, slice, range 。这个语言搞了那么多 syntax sugar,
然后这些不支持 user 的 container 。更因为没有 generics ,user container
根本没法提供 type safety 。然后 map / array / slice somehow 有 type
safety 。都 1.5 版本了,连最基本的东西都没有。
7) 傻逼的 typed nil != nil 。Go 语言是可以产生 typed nil 。这玩意还不能
简单的 nil check 。玩玩下面的代码。想吐了么?
package main
type A struct{}
func foo (a interface{}) {
if (a == nil) {
println ("is nil")
}
if (a == (*A)(nil)) {
println ("is type A nil")
}
}
func main() {
var p *A;
foo (p);
println ("==========")
foo (nil)
}
8) 傻逼的 syntax 。居然强制性的要求 { 必须在 function / if 的那一行末尾。
事实上,{ 在下一行一般来说查找起来更方便。就算你喜欢在行末尾,也没必要
强制性搞成这样吧。
9) 傻逼的 instance method / composition / inheritance 。这方面 Go 彻彻
底底是个烂摊子。随便给个例子:
package main
type A struct{}
type B struct{
a A
A
}
func (a *A) foo () {
println ("foo")
}
func bar (a *A) {
println ("bar")
}
func main() {
b := B { A{}, A {} }
b.a.foo ()
b.foo ()
bar(&b.a)
bar(&b) // prog.go:24: cannot use &b (type *B) as type *A in argument to
bar
}
珍惜生命,远离 R 和 Go 。
1 (共1页)
进入Programming版参与讨论
相关主题
please help C++ beginnertypedef 的一个问题
[合集] 请牛人解释为啥C++ has stronger typing than C//bowhttp://golang.org/ 你们都是hello 世界吗?
C++一问Golang的promise lib哪个好?
What're the three types of memory allocated for C++ variables?From C++ to C
两个我永远都不想碰的语言写惯了C++ code,再写C code真不习惯
python 本来就是个烂语言,早晚崩盘。Python Q: function pass in struct pointer, come back with data filled
C到底能走多远。。。。。。Java终于要支持primitive type的generic了
Why C++11 introduce "decltype" and "auto"?access violation of C# in Visual Studio 2013 (转载)
相关话题的讨论汇总
话题: go话题: nil话题: struct话题: type话题: println