Disadvantage of Go
1 No Generic For Now
That make user coding repeat code many times, even for basic type such as
int float bool
It is not easy , even to make a generic min function.
using interface will always check type casting.
and for []interface{} in generic function, u can't do cast
2 Incomplete Type in Basic Lib
Take math lib as an example, math.Max math.Min are only for float64 ,
you have do stupid conversion for other type.
3 No Default Value for struct.
Consider multilayer struct. A {B {C {D {E {F} } } }
to init A to a default value will be complicated.
And how about A[] slice
And what if D E F are from third party lib ?
You have to dig into 3rd party code just for its default value.
For It may have none zero default value.
4 Can not Cycle import.
package A B can not import each other at the same time.
While other language can.
It seems not a big deal just put the the common thing in a new package
But when the package and project grow bigger, it just easy to say.
This change will affect all caller.
5 Inconsistent type conversion
bool type are normal type just like int and float ,
but u can't do below. while other type can cast to others
int(bool) bool(int)
6 No multi casting expression
func foo() (int16, int8)
var i,j int32 = (int32,int32)(foo())
Since go can't do this, why go provide multi return value.
7 No Ternary Expression
hardly find a language without it except go
8 No Negative Index for slice
all other script language support a[-1] as a[len(a)-1]
When programing in go
we have to do repeated type casting many times, due to the above.
write long code for Ternary ,int(bool) a[-1] etc
init big struct with default value.
Which make Go not an Elegant and simple language.
Once I thought go was a simple language,
but in fact we write more code.
All above are proposal for many times.
And it is 6 years(or more).
These basic functions are still not added. some of that should be add in
version 1.0
I belive most above could make go simpler,
someone know a little programing could know how to use it.
however someone still fear it make go complicate like c++
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.