Earlier quoted context omitted.
Hold on, did you just say Go doesn't have a Dictionary data type? I'm a Javascript, Lua, Python, and C# guy and Dict is my whole world.
Not a programmer, so this is every programmer's chance to hammer me on correctness. No, Go doesn't have a type named Dict, or Hash (my Perl is leaking), or whatever. It does have a map type[1], where you can define your keys as one type, and your values of another type, and that pretty closely approximates Dicts in other languages, I think. [1]: https://go.dev/blog/maps
Go is my hammer, and everything is a nail
301–310 of 816 posts
Re: Go is my hammer, and everything is a nail
#302Earlier quoted context omitted.
The problem with C# is its created by Microsoft, even if its a good language its hard to look at it and not think how much its limited while used outside of Windows.
It seems that you might be asking this question in bad faith. But on the off chance you are not, please find previous replies that address the same kind of question below: https://news.ycombinator.com/item?id=41037792 https://news.ycombinator.com/item?id=41189309 https://news.ycombinator.com/item?id=41211767 https://news.ycombinator.com/item?id=41197493 https://news.ycombinator.com/item?id=41218353
Re: Go is my hammer, and everything is a nail
#303Earlier quoted context omitted.
Yes, because one can either turn off the GC, allocate memory up front (arena style), or call C or Assembly from Go. The performance is likely to be good enough with GC turned on, though, because it is unusually fast.
Turning off the GC isn't the blocker. Plenty of GC languages manage. I'm more interested in how Go handles graphics APIs and binding a render thread or working with GUI threads considering how goroutines are done. Does one need to write non-idiomatic go, avoiding goroutines or is there some trick? For example, GTK isn't thread safe so you can't just use that library without considering that.
Re: Go is my hammer, and everything is a nail
#304Life is barely long enough to get good at one thing so you should choose your thing wisely. That's wisdom I've held for quite some time. Coincidentally, I chose Go as my language of choice as well. The factors that led me to that choice were many, but to highlight some: - incredible standard library - simple to read and write - single static binary builds (assets included, like html/images, etc) - don't need a contai…
What game engines use Go?
Re: Go is my hammer, and everything is a nail
#305Earlier quoted context omitted.
I am someone with significant experience in Java, C#, C++, and JS/TS. I am a bit of a newbie to Go but have used it for a few things at work. So, I can give a bit of a comparison for you. I really like the DevX and strong standard library of Go. Also I really like that the community around Go has a strong preference for just using the stdlib and not going crazy with third party libraries. Languages are just tools but…
Hey, thanks for the reply. That sounds really nice! I wonder, which aspects of the "Go" std lib are considered strong? Would you say it is more like .net where the std-lib also comes with framework-grade capabilities such as REST-endpoints and setting up applications? Because in the classical sense of a library, I think Java is fantastic (collections, strings, NIO, HTTP 2.0, etc.). But it misses framework-level out-o…
Re: Go is my hammer, and everything is a nail
#306Earlier quoted context omitted.
It seems that you might be asking this question in bad faith. But on the off chance you are not, please find previous replies that address the same kind of question below: https://news.ycombinator.com/item?id=41037792 https://news.ycombinator.com/item?id=41189309 https://news.ycombinator.com/item?id=41211767 https://news.ycombinator.com/item?id=41197493 https://news.ycombinator.com/item?id=41218353
I understand its probably not the case today, just that C# shares some of the MS reputation and its hard to get rid of. Especially when there are dozens of open-source independent languages around.
Somehow we all can normally discuss programming languages without bringing practices of Google or Oracle into the picture and focus instead on programming language development initiatives that they drive and sponsor, that are themselves sufficiently independent. Let's keep it that way.
Also https://news.ycombinator.com/item?id=41218353 (which was the last link in the list).
Re: Go is my hammer, and everything is a nail
#307Earlier quoted context omitted.
I would rather go had real enums, and I would _prefer_ if there were sum types. I agree it's more verbose, but I don't find that that verbosity really bothers me most of the time. Is res= [x for x in foo if "banned" in x] really actually more readable than var result []string for _, x := range foo { if strings.Contains(x, "banned") { result = append(result, x) } } ? I know it's 6 lines vs 1, but in practice I look at…
I agree that list comprehensions aren't any easier to read. A proper streaming interface on the other hand lets you easily follow how the data is transformed: foo .stream() .filter(x -> x.contains("banned")) .collect(Collectors.toList()); As an aside, Go conflating lists and views irks me, in part due to what weird semantics it gives to append (e.g. if you have two disjunct slices and append an element to one slice,…
func copyArrStringShallow(x []string) []string { return x }
// strings are immutable in go, but for []byte etc also deep copy that.
func copyArrStringDeep(x []string) []string {
ret := make([]string, 0, len(x))
copy(ret, x)
return ret
}Re: Go is my hammer, and everything is a nail
#308People always under-estimate the cost of properly learning a language. At any given time I tend to have a "main go-to language". I typically spend 2-4 years getting to the point where I can say I "know" a language. Then I try to stick to it long enough for the investment to pay off. Usually 8-10 years. A surprising number of people think this is a very long time. It isn't. This is typically the time it takes to under…
Now if I were starting out I think I would try to focus on two different languages, but more modern ones. Maybe Rust and Python?
Re: Go is my hammer, and everything is a nail
#309The author lists multiple reasons for this, but for me the biggest one is the first one: Go is good for almost everything . I have extremely good productivity when using Go. Once your project exceeds 100 lines it is usually even better than python. And yes, I am aware that Rustians did a survey where Rust was crowned as the most efficient language but in my reality (which may differ from yours) Go is simply the best…
There's nothing impressive in these slides. This may have been pretty good in 2012, but this code looks very much like the equivalent Swift or Rust.
Re: Go is my hammer, and everything is a nail
#310Earlier quoted context omitted.
Also: interfaceiritus. Someone saw "accept interfaces, return structs" somewhere and now EVERYTHING accepts an interface, whether or makes sense or not. Many (sometimes even all) of these interfaces have just one implementation.
Doing this allows you to mock out that implementation in unit tests.