⬆️ ⬇️

What I don't like is Go

At the current job have to use Go. I am well acquainted with this language. I don't like him, and his popularity puzzles me.



Ergonomics development



I have never met a language that is so openly opposed to convenience for a developer. For example, Rob Pike has repeatedly and openly hostile to any discussion of syntax highlighting on the Go Playground . In response to reasonably formulated user questions, his public answers sparkled with disdain and disrespect:

')

Gofmt was written specifically to reduce meaningless discussions about code formatting, which was great. Unfortunately, this did not affect the number of meaningless discussions about syntax highlighting or, as I prefer to call it, spitzensparken blinkelichtzen.


And again in the 2012 Go-Nuts branch:



Syntax highlighting - for small ones. In childhood I was taught arithmetic on colored sticks . Now I have grown up and use black and white numbers.


Clearly, of Rob’s acquaintances, no one suffers from synesthesia, dyslexia, or poor vision. Because of its position, the official Go site and documentation are still without syntax highlighting.



The Go development team is not limited to Pike, but the others strongly support his attitude to ergonomics. In the discussion of union / sum types , the ianlancetaylor user rejected a request specifically defining the advantage of ergonomics as being too insignificant and not worthy of attention:



This has been discussed several times in the past, including before the open release. Then we came to the conclusion that sum types do not particularly extend the interface types. If you look, in the end it all comes down to the fact that the compiler checks that you have filled in all cases of type switching. This is a pretty minor advantage to change the language.


This attitude is at odds with the opinion of union types in other languages. In 2000, JWZ criticized Java:



, enum :keywords . (, , «`enumeration value x', switch»).


Java , Java .  â€” , Rust, Scala, Elixir , Go, C â€” , . , , Go .





, . .



, Go . , . Go « » « », .



, « ». , , , , , . Go , , Java 1.4.



— . , , , . , Go.



Google, «» «» .





go get . — , Go .



Go, , , . C Autotools — , . , 21 .



GOPATH



. vendor , , «» «» .



, Go « » .



Go



Go , , ( ; Go ) error , nil « ».



, Go. , , . , : , , error - , , — .



Go , - :



a, err := fallibleOperationA()
if err != nil {
    return nil, err
}

b, err := fallibleOperationB(a)
if err != nil {
    return nil, err
}

return b, nil






a = fallibleOperationA()
b = fallibleOperationB(a)
return b






return fallibleOperationA()
    .then(a => fallibleOperationB(a))
    .result()


.



, ( , ). . , . :



a, err := fallibleOperationA()
if err != nil {
    return nil, err
}

if err := fallibleOperationB(a); err != nil {
    return nil, err
}

c, err := fallibleOperationC(a)
if err != nil {
    return nil, err
}

fallibleOperationD(a, c)

return fallibleOperationE()


- .

Source: https://habr.com/ru/post/434446/



All Articles