6 ms·
I'm sorry you lost me after your outrageous claim that one must learn everything about the standard types of Go before one can program effectively. You should
by jamra 12y ago
I'm sorry you lost me after your outrageous claim that one must learn everything about the standard types of Go before one can program effectively.
You should know about how your types are passed around if you are using any language.
The example given was arrays in Go. Arrays are passed by value, but slices (pointers to arrays) are passed by reference. This is very simply described in the Effective Go reading. It's not a hard concept. I don't like you writing off Go with that example. It sounds like you made an emotional decision against the language and are grasping for logical reasons to support your already made decision.
How many people programming with Go pass arrays around? It's an easy lesson to learn.
- nulltype 12y agoI think slices are actually passed by value. From "Effective Go": "We must return the slice afterwards because, although Append can modify the elements of slice, the slice itself (the run-time data structure holding the pointer, length, and capacity) is passed by value."
- jamra 12y agoYou are absolutely correct. To borrow form another's comment, https://play.golang.org/p/VOUJI88PNj https://play.golang.org/p/VOUJI88PNj The slice, however, is a small structure to pass to a function in that you are not performing a copy of each individual element in the slice.
- eloff 12y agoThere are many valid criticisms of go, but the one presented in this article make no sense. Or maybe only make sense if you're a huge dynamic languages fan and can't stomach static typing. Personally, as someone who used to be a huge fan of dynamic languages like Python, I've sobered up as I've grown older and had to fight with large python and JavaScript code bases. A compiler that is fast with clear error messages is tremendously valuable.
- Dewie 12y agoIf using dynamic typing like Python's is being drunk, then at least Go is like being tipsy - not quite sober, but quite functioning.
- bkeroack 12y agoOnly if you make a habit of using reflection (you shouldn't). Otherwise it's designated driver all the way.
- deleted 12y ago[deleted]
- thomasahle 12y ago> Only if you make a habit of using reflection Or type switches. Or nearly anything involving interface{}.
- tel 12y agoTipsy is probably the most dangerous mode. People feel like they can probably still drive when they're just tipsy.
- lomnakkus 12y agoNo. Drunk driving is much worse. (Yes, people do that -- I mean they actually understand that they are "drunk" and not just "tipsy"... and unfortunately still drive :/.)
- tel 12y agoAh, yeah, I wouldn't want to claim that tipsy driving is worse than flat out drunk driving. I only wanted to suggest that there's higher net risk when it's less dangerous but is perceived to be not dangerous at all.
- nkozyra 12y agoYes, thank you. This was an instant head-scratcher: "However, the type system of Go is so complex" The type system is anything but complex, even in the non-system complaints expressed.
- chimeracoder 12y ago> I'm sorry you lost me after your outrageous claim that one must learn everything about the standard types of Go before one can program effectively. I can't help but be amused to see the complaint that Go's type system is, of all things, too complex. At the time I first picked up Go, Racket was my favorite language of choice[0]. One of the biggest things I noticed about Go was how little I needed to think about types and implementation. Part of this was simply having a static typechecker[1], but part of it is how the rest of the tooling is designed as well. > How many people programming with Go pass arrays around? Most people using Go shouldn't be using arrays at all, since they really don't fit most use cases (fixed size and size is part of the type). [0] For the record, I still like Racket, but I've found I'm undeniably far more productive in Go. [1] Type Racket exists, but at least at the time, most libraries were untyped, which meant I had to write typed wrappers for everything.
- Rapzid 12y agoJust a nit, everything is passed by value in Go including slices. Here is an example highlighting why it may be important to keep this in mind: https://play.golang.org/p/VOUJI88PNj https://play.golang.org/p/VOUJI88PNj . Regardless of this, I learned Go during the last Stripe CTF and placed top 5 in one of the rounds with it sooo... I don't believe learning to be effective with it takes all that long. It was quite enjoyable to learn as well.
- jamra 12y agoNot just a nit. You are right. I wrote my comment in haste. Had to take someone to the airport. I think the essence of my point still stands in that the example the author provides is very shallow and hardly something that stops you from writing Go or even writing any kind of protocol in Go.