Hey guys, welcome back to another video. So some of you wanted me to do a video comparing Rust to other languages like C and Go. But I haven’t thought of enough to talk about. These languages all have their advantages and disadvantages. And depending on what you’re developing or how you like to program, you will find some more appealing than others.
Find me elsewhere:
Instagram: https://www.instagram.com/kamiyaa91/
Github: https://github.com/kamiyaa/
Books I’ve been reading:
The Lean Startup by Eric Ries: https://amzn.to/3hwbg3J
Late Bloomers by Rich Karlgaard: https://amzn.to/2DcmCLo
Disclaimer, these are affiliate links. If you make a purchase, I will receive a commission.
But today, I want to talk to you about the problems I have with the
Go progrmamming language. Specifically, I’ll be going over 5 problems because it just so happened I could only come up with 5. So I’ve been using Go for various projects for about a year now and I’ve come across a lot of issues with it. Now these issues doesn’t mean I’m saying Go is a bad language and it does not mean I won’t use Go in the future. It’s just things that make me want to use the language less because it doesn’t feel as nice to program in. And I’ll be going through these issues from least impactful and to more
impactful ones that I think could be genuine issues.
String, Print, Formatting APIs
Golang follows the same conventions as C, using %s, %d, %c and so on to indicate what type you want to print. I don’t think keeping this was necessary and they could’ve opt-ed for a much better solution. For example, in Javascript, we have string interpolation using `${var1} ${var2}.
And in Python and Rust, we ditch the % formatting for a generic {}.
No generics
I understand this was a conscious decision made by the creators because they wanted the language to be simple, so they left out things like macros and generics. Which kind of sucks but you can bypass this for the most part using interfaces
Namespacing
I think the namespacing capabilities in Golang is pretty weak. They impose a lot of restrictions and you can’t do things like referencing packages inside packages or having associate functions. So if your package has more than one struct and you want to create constructor functions for them, then you will need really long function names so they don’t conflict with each other. But again, you can work around this with a builder patten.
Honourable mention: $GOPATH environment variable
This caused a lot of headaches when Go first came out because it was mandatory. Developers was forced to develop under the GOPATH and dependency management was a pain. But fortunately, with recent Go releases and the use of a go.mod file, this is no longer the case.
Hope you enjoyed the video!
Music:
Background music by Pep8: https://soundcloud.com/user-808315049-409100976
Michikusa by PeriTune (Licensed under https://creativecommons.org/licenses/by/4.0/)
Timestamps:
00:00 Intro
00:55 1. Inconsistent Syntax
01:30 2. String, Print and Formatting
02:11 3. No Generics
02:29 4. Namespacing
02:55 Honourable Mention
03:23 5. Error Handling
04:54 Solutions to (5)
#golang #go