4 ms·
>io.Reader and Writer are interface{}'s[1]. With this statement, you've shown you have close to 0 Go experience. * interace{} - a place-holder for a value of
by PopsiclePete 9y ago
>io.Reader and Writer are interface{}'s[1].
With this statement, you've shown you have close to 0 Go experience.
* interace{} - a place-holder for a value of "any type". It means "a value that satisfies the empty interface", i.e. an interface with no methods. All types implement it. To do anything with the actual data it encapsulates, you have to do a type assertion to unbox the value. The type assertion will panic or return an error if the type assertion is incorrect. This is something like C's void , or Java's Object.
io.Reader, io.Writer - these are interface types that specify a set of methods that must be implemented by another type in order to satisfy that interface. These are akin to C#/Java's interfaces, but are less restrictive in the sense that any type in Go can implement them, not just "classes". E.g., http.HandlerFunc - a function type that implements the http.Handler interface.
- laumars 9y ago> With this statement, you've shown you have close to 0 Go experience. With that statement you've shown yourself to be an arrogant dick so I stopped reading. Maybe when you're in the mood to play nice I'll link you to some of the stuff I've written in Go over the last 6 years. Some of them are pretty cool - if I do say so myself - and definitely not beginner projects. For what it's worth, we all have the occasional blind spot when it comes to semantics. Including yourself. So there's no need to be an arrogant dick the few occasions you happen to be in the right.
- warent 9y agoWhen having an off-day, I find it's sometimes best to pause before saying something. The irony of this comment is really unfortunate
- laumars 9y agoYeah, it is unfortunate. My ranting was born from frustration that HN used to be a refuge from the usual pointless egotistical jibes as seen on other forums and social platforms. But over the years the quality of counterarguments has slowly been lowering to the level where it's now commonplace for people to make judgemental remarks about a persons ability based solely on a solitary semantical error (I obviously get the distinction between the two - I just wasn't aware they were described differently in literature). I have amassed a large body of real world projects under my belt over the last 3 decades and have used Go for 6 of those years. I've written some pretty interesting stuff in Go like file systems compiled against FUSE and compilers. Yet I by no means consider myself an expert in anything - least of all Go - as to do so would imply I'm not open to learning something new (even basic things I somehow missed during my initial studies). Despite that I still find it highly offensive and unnecessary for someone who knows nothing about me to say "you have close to 0 Go experience." when I've clearly demonstrated and described various Go-isms prior to his or her remark. Edit: weirdly I've got more down votes for this comment than my last one. I guess some people think rudeness is acceptable. Sad times.