Hacker Newsnew | past | comments | ask | show | jobs | submit | bitfield's commentslogin

Author here, thanks for posting! This recent Reddit discussion might give you a bit more information: https://www.reddit.com/r/golang/comments/1mmeg55/the_deeper_...


For more on the modern functional style in Go, including Map, Reduce, Filter, Sort, and so on: https://bitfieldconsulting.com/golang/functional


GPT-4 to be rebranded "Really The Last One".



I have just read your article. This is interesting, I keep that in mind if one day I change my mind about Go and use it.


"While we could usually write the specific code we needed for a particular program, before Go generics it wasn’t easy to write functions on arbitrary container types, such as slices.

For example, we couldn’t write a function that takes a slice of arbitrary type and determines whether the slice contains a given element. Instead, we had to write a function that takes some specific type, such as []int, or []string.

But this is dull, because the logic is exactly the same, whatever the type of the slice element. And now we can write that function just once, for all types. Let’s try."


What problem does 'defer' solve? When should we use it? How does it interact with named results? What's the use of deferring a closure? Is it okay to write naked returns?


one common use is the 'try/catch' mechanic. if a panic happens in go, and you want to be able to recover you'd use a defer.

it's also used in the 'autoclosable' type way. It's easy when opening a resource, to 'defer closing' them right then / there.

go takes a slow, methodical approach to feature changes. sometimes people think 'too slow', some think it's fine.

there are times when you 'defer' and you think - mmm that was nice. sometimes it's "ugh i guess i have to defer this now...."

it has its uses


Tests communicate a lot of information, to readers, other developers, and even our future selves. Well-written tests focus on a single unit of behaviour that can be described in a brief sentence, and we can use that sentence as the name of the test.


“If you get fired as a result of applying the advice in this book, then that’s probably for the best, all things considered. But if it happens, I’ll make it my personal mission to get you a job with a better company: one where people are rewarded, not punished, for producing software that actually works.”


"First, it's really important to say that both Go and Rust are absolutely excellent programming languages. They're modern, powerful, widely-adopted, and offer excellent performance. You may have read articles and blog posts aiming to convince you that Go is better than Rust, or vice versa. But that really makes no sense; every programming language represents a set of trade-offs. Each language is optimised for different things, so your choice of language should be determined by what suits you and the problems you want to solve with it.

In this article, I'll try to give a brief overview of where I think Go is the ideal choice, and where I think Rust is a better alternative. I'll also try to give a flavour of the essential nature of both languages (the Tao of Go and Rust, if you like)."

https://bitfieldconsulting.com/golang/rust-vs-go


No one wants to hear about this stuff unless you have a good acronym to go with it.


Hilariously true


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: