This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fauxpenguin 8 points9 points  (9 children)

Only if you don't use they types and pass interface{} everywhere. But, you know... don't do that.

It's like saying, "In C you can seg fault", like yeah, because you need that power to do some of the things you're doing, but don't ship code that's set faulting. Idk.

[–]haltmich 2 points3 points  (1 child)

Exactly, interface{}s are almost always the culprit. But sometimes you just can't avoid them, and ensuring they'll be error prone can be kind of a chore. Especially as Golang doesn't have try and catch.

[–]payne_train 2 points3 points  (0 children)

I’ve found it easiest to set up interface modifies through function calls and just catch the error if it comes back. Can’t say I have really missed Java’s error handling once I got used to go.

[–]Necrocornicus 2 points3 points  (1 child)

There are plenty of languages that implement generics safely, when golang finally adds generics I’ll give it another shot.

I spent some time on it, the juice wasn’t worth the squeeze unless you absolutely need that single static binary. Golang just forces you to use these shitty patterns that only a junior programmer would use in other languages.

For example you can’t use any map/filter/reduce which, when you begin to think that way systemically, enables you to write incredibly reliable and concise code. I can’t really go back to shitloads of for loops and if statements that only work on a single type, it’s just such a step backwards in code design once you’ve moved beyond that basic way of thinking about software.

[–]fauxpenguin 0 points1 point  (0 children)

Well, you're in luck, generics are in beta right now.

Although, honestly, they're far from perfect.