2 ms·
No garbage collected language will ever have RAII, the features conflict. Go does not have RAII, but tries to fix it with "defer" [1]. As for why not, you'd ha
by candiodari 9y ago
No garbage collected language will ever have RAII, the features conflict. Go does not have RAII, but tries to fix it with "defer" [1].
As for why not, you'd have to ask the Go team. But my guess would be that as a general rule, Go does not have language feature X. It's a very, very basic language deliberately lacking pretty much every modern language feature you can think of. The pro/con is that programming in Go is very delibarete. Go programs will only ever do what you explicitly make them do, to an almost ridiculous extent. If a Go program knows how to sort a list of customers, it takes 20 lines of code to make it aware of how to sort any other record type. Especially operations minded people this is a big plus.
[1] https://blog.golang.org/defer-panic-and-recover https://blog.golang.org/defer-panic-and-recover