Live data from Hacker News

What I'd like to see in Go 2.0

sethvargo.com

151–160 of 223 posts

Re: What I'd like to see in Go 2.0

#151
post #121

Earlier quoted context omitted.

Is this comment meant for this article? I can't for the life of me grok what you mean!

Guessing it was meant to go on https://news.ycombinator.com/item?id=30205232 ? No idea how it ended up here

Completely true. How it got here, no idea.

Re: What I'd like to see in Go 2.0

#152
post #148

I think Golang is awesome, but I have two major gripes that I hope can be fixed: Dependency management: Go mods is a dumpster fire. `go get` and `go install` is finicky and inconsistent across systems. It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack th…

What you describe for JSON is already the case in Go; the stdlib json parser does simply throw out any extra fields on deserialisation.

Re: What I'd like to see in Go 2.0

#154

Earlier quoted context omitted.

Have you considered elaborating? I am likewise unsure how a language could get enums wrong, even after reading your post.

> I am likewise unsure how a language could get enums wrong, even after reading your post. By allowing any value of the underlying type, even if they were not values of the enum. The language most famous for this is obviously C: enum foo { A, B, C }; int main() { enum foo x = A; printf("%d\n", x); enum foo y = 42; printf("%d\n", y); } This will print `0` and `42` ( https://godbolt.org/z/Yq8qq5bzW ), because C conside…

This is only a problem in languages that don't support checked type safe enums / discriminated unions, but this whole thread was started to request that feature. I don't get the point of your comments unless it's to state "be careful or they'll do it wrong"... which is obvious and already acknowledged several times in this thread.

Re: What I'd like to see in Go 2.0

#155
post #148

I think Golang is awesome, but I have two major gripes that I hope can be fixed: Dependency management: Go mods is a dumpster fire. `go get` and `go install` is finicky and inconsistent across systems. It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack th…

> It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack that replaces mod references to private repos and I have to mess with my git config to properly authenticate.

With regards to this concern at least go 1.18 is adding workspaces, which should help (https://sebastian-holstein.de/post/2021-11-08-go-1.18-featur...).

Re: What I'd like to see in Go 2.0

#156
post #123

Earlier quoted context omitted.

> Not vice versa (the current design). select { case: chan3_whichItreatTheSameAsChan2 }

Yes, as I have mentioned, there is performance loss, comparing to select { case: chan3_whichItreatTheSameAsChan2 }

1) Is there really a performance loss compared to if select was deterministic?

2) What in the world do you need such code for?

Re: What I'd like to see in Go 2.0

#157
post #148

I think Golang is awesome, but I have two major gripes that I hope can be fixed: Dependency management: Go mods is a dumpster fire. `go get` and `go install` is finicky and inconsistent across systems. It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack th…

What you describe for JSON is already the case in Go; the stdlib json parser does simply throw out any extra fields on deserialisation.

In fact it's difficult-to-impossible to get the opposite (only json.Decoder supports a strict mode, and as soon as one intermediate type implements UnmarshalJSON it stops getting propagated).

Re: What I'd like to see in Go 2.0

#158
post #121

Earlier quoted context omitted.

Is this comment meant for this article? I can't for the life of me grok what you mean!

Guessing it was meant to go on https://news.ycombinator.com/item?id=30205232 ? No idea how it ended up here

We'll move it. Thanks!

Re: What I'd like to see in Go 2.0

#159
post #78
post #2

From Rob Pike on reddit regarding this post[0]: The and and or functions in the template packages do short-circuit, so he's got one thing already. It was a relatively recent change, but it's there. Non-deterministic select is a critical detail of its design. If you depend on a deterministic order of completion of tasks, you're going to have problems. Now there are cases where determinism might be what you want, but t…

> but (deterministic-select cases) hey are peculiar. It looks for most select blocks in Go code, it doesn't matter whether or not they are non-deterministic or deterministic. But, if the default is deterministic, user code could simulate non-deterministic, without much performance loss. Not vice versa (the current design).

Er, when it comes to concurrency, non-determinism is usually cheaper than determinism. As soon as you care about ordering, you almost always have to synchronize, and that has a cost.

Austin Clements (of the Go runtime team) wrote a paper that explores this in detail [1]. That was before joining the Go team, but the concepts are universal.

[1] https://people.csail.mit.edu/nickolai/papers/clements-sc.pdf

Re: What I'd like to see in Go 2.0

#160

I would add: an extended standard library for "common stuff". I don't want to import a third-party library nor write my own "utils.go" to do: func contains(s []int, e int) bool { for _, a := range s { if a == e { return true } } return false }

If you need to look up or worse, delete, a value in a slice, then you probably shouldn't be using a slice in the first place. You probably want to replace your slice with a set.
Post reply on HN