back to home

ok go just SUCKS.

ok not even gonna start with a disclaimer here because i refuse to believe anyone unironically uses this abomination of a language

i thought it would be a fun idea to finally finish aoc 2019 (since i deleted all my old code for that year), and i also thought i should do it in a new language for a fun challenge

since i had tried rust and hated it, i thought i should try go, a language people often compare it with for some reason

and i believe that although rust sucks, go is 1000x WORSE.
so let's get down into the weeds of it, shall we?


i didn't have any prejudices coming into this, no.
maybe the fact that i was also learning vim at the same time had some impact
here's my `.vimrc` if anyone cares
but given that i had a positive experience with vim, i don't think so

regardless, after doing 24 days (skipped 2019's day 22 bc of the large numbers involved), i've come to realize what go is.

does anyone? remember the "kids mode" on certain applications that would shut down some functions of the device so kids couldn't do sussy stuff?
i remember my parents put that on the ipad so i couldn't play games lol

that's go!
the developers think we're too dumb to be trusted with any nice syntax sugar or features that have even the smallest percentage of a chance at being unsafe, so they just make go the most bare bones thing that it can possibly be.

THIS GOPHER CAN EAT MY RIGHT NUT

this gopher is a blight upon god's green earth.

list of grievances (as always)

no unused variables??

go and i got off on the wrong foot when it tried to pull this on me:

``` sanspapyrus683@kevin-laptop:~/GitHub/advent-of-code/y2019/go$ go run . <<< "2" # aoc2019 ./day2.go:44:2: x declared and not used ```

i'm...sorry? is this a warning? if so, why is nothing else printing?

NO.

turns out it's a godammned ERROR.
the neckbearded linux emacs users over at google thought no code should have unused variables, so they made it so that code just...didn't compile.

THERE ISN'T EVEN ANY CONSISTENCY WITH THIS RULE??!!
unused vars and imports are errors, but unused function parameters and functions

way too many times i've gotten the general layout of a program down and i want to run it to see if any RTEs happen only to be met with this stupid, godforsaken error.

no sets...

yeah.
to get sets, you have to do this workaround:

```go inbredSet := map[int]bool{1: true, 3: true} inbredSet[9] = true // to add an element delete(inbredSet, 1) // to delete an element ```

for a language that has its compiler autoinsert semicolons so it's "cleaner," this sure as hell is not clean, go.

1984 brace style

oh! speaking of semicolons, did i mention that because of that semicolon insertion, golang actually doesn't allow if statements like this:

```go x := 2 if x == 2 { fmt.Println("x is 2") } ```

i wasn't a fan of this brace style anyways, but people should be free to use it if they want to!

stupid naming conventions

did i mention the naming?

in go, everything, even including constants, are named in camelCase.
the only exception is public exported things, which are named with PascalCase.
whose bright idea was that?

when i'm typing an identifier, it's kinda helpful to know whether it's a variable/function, class, constant, or anything! especially in a language where functions can be passed around and assigned

weird assignment ops

also, what's with the two different assignment operators `:=` and `=`?
why can't go just just handle variable scope normally like every other language?
because of go's crap, i can't do this:

```go type testStruct struct { a int } x := testStruct{2} x.a, b := funcThatReturnsTwoValues() // this errors. need i say more? ```

awful arrays

say you want to make a 2d array of 1's. should be a simple enough endeavour, right?
well in GO, here's what you have to do

```go stupidArr := make([][]int, 5) for i := 0; i < len(stupidArr); i++ { for j := 0; j < 7; j++ { stupidArr[i] = append(stupidArr[i], 1) } } ```

also, see that `append` function?
you have to type in the array name TWICE to append it, so if you have a really long way to get to an array, well, good luck!

no ternary

even rust at least has some primitive form of "if condition then this value, else this value"
so instead, i have to do this:

```go var x int if condition { x = value1 } else { x = value2 } ```

congratulations, go. you've managed to turn one line of code into SIX.

no inline increments

ok this complaint isn't too big, but still.
i see no reason why this is "unreadable" unless you're like just starting out in programming or something:

```go arr[ind++] = val ```

bruh.

really, really empty stdlib

remember when i said there were no sets?

well, turns out like a billion other data structures and stuff are lacking in this language
i actually had to copy paste a priority queue implementation FROM SCRATCH to implement dijkstra's algo!!

at least there's regex, but that's cold comfort when even c conditionally has em

no tuples or pairs or anything

yeah.

if you want a map that holds two values, you have to slog through the creation of a whole new struct and then pass that struct to the map type.
because of this, what could have been a simple

```go x := make(map[int](int, string)) ```

gets turned into

```go type mapVal struct { a int b string } x := make(map[int]mapVal) ```

what the hell, man?

"conclusion"

i remember saying that rust was fine, it would just take some time for me to get used to it.

well, i'm NEVER getting used to this trash heap of a language.
people joke that js was made in like 3 days or whatever, but THIS is the real 3-day-wonder.

bye. god i'm burnt out.