Remix.run Logo
b7e7d855b448 3 hours ago

You guys can keep complaining about how go is too verbose, but I love everything about go.

I love the error handling, I love the forced formatting, i love all the linting it has including style guides. When you read other source code it's so easy to understand it and make sense of it. Thank you go team

(Ok, maybe I am a bit sceptical with the latest generic additions, but overall it's a great language. I love it.)

wannabe44 3 hours ago | parent | next [-]

Oh yeah totally agree. I don't understand why someone would want to write `slices.Contains(s, needle)` when you can write this beautiful poem like a Shakespeare in VSCode:

    found := false
    for _, v := range s {
        if v == needle {
            found = true
            break
        }
    }
Oh and I totally want to build a stack trace manually. It's like doing cardio to me.

    if err != nil {
       return fmt.Errorf("my function name but in spaces: %w", err);
    }
This is very elegant by the way, so that we need errors.Is now, which has to dynamically check if the error implements Unwrap() error or Unwrap() []error. Because having any language facilities for error handling is harmful.
b7e7d855b448 2 hours ago | parent | next [-]

I don't say it's perfect, but right in this moment I feel most comfortable with go and I don't mind jumping through a few hoops or writing things multiple times

msie 2 hours ago | parent | prev | next [-]

You forgot to put /s after your post.

logicchains 3 hours ago | parent | prev [-]

Your handwritten one has a major performance bug:

    found := false
    for _, v := range s {
        if v == needle {
            found = true
            break
        }
    }
Do you see it? It copies the v into a local variable, which could be tremendously wasteful if it's a large struct. You should instead be taking a pointer to s[i] and comparing the value there with `needle`.

If you'd used `slices.Contains(s, needle)`, on the other hand, it could have such a performance bug in it and you'd never know.

kajman an hour ago | parent | next [-]

> If you'd used `slices.Contains(s, needle)`, on the other hand, it could have such a performance bug in it and you'd never know.

Perhaps you're much better at programming than I am, but I prefer these semantics in a language because I figure they're much more likely to have been optimized empirically, support vectorization, and be less buggy than another rote loop I'm trying to speed through.

boredatoms an hour ago | parent | prev | next [-]

or contains() could be written by those who can write performant code, ..once

mathisfun123 an hour ago | parent | prev [-]

> on the other hand, it could have such a performance bug in it and you'd never know.

wut...? the debate isn't between closed (incompetent) source and open (competent) source - the debate is between verbose language and expressive language.

eptcyka 2 hours ago | parent | prev | next [-]

I love how during prototyping, the compiler will tell me off for having an unused variable and fail to compile. I totally love the idea of crashing when writing on a closed channel.

Someone 2 hours ago | parent | prev | next [-]

> I love the error handling

Even if you prefer manually checking for errors after every call that might fail, I fail to see how one can love go’s verbosity. Compare go’s

   foo, err := bar()
   if err != nil {
     return ERR;
   }
with something like (hypothetical)

  foo := bar() ||| return ERR;
where the compiler, seeing that bar returns an Either<int,err> can enforce the presence of the ||| clause or, alternatively, require later code to check for errors if the ||| clause isn’t present. I think that’s both more robust (prevents one from forgetting to check for errors) and shorter (allowing for showing a lot more code on a screen or page)
jerf 3 hours ago | parent | prev | next [-]

If generics were going to ruin the language, they would have by now. I think you can rest easy.

ncruces 3 hours ago | parent [-]

The greatest thing about generics is … that they're not used much if at all.

Which is a great way to make sure they're not overused, which in my experience is better than underuse.

gempir 2 hours ago | parent | prev [-]

It doesn't have a lot of style guides or linting though. You have to install and configure quite a lot of tooling for that