Earlier quoted context omitted.
Basically they dismissed every implemented approach, despite generics obviously working in other systems. (And it's hardly a "new" feature unless we're counting in multiples of decades.)
> Basically they dismissed every implemented approach, despite generics obviously working in other systems. But working at a price. And Go isn't willing to pay the price (especially in terms of compile time). If Go ever adds generics, it will be with a new approach that doesn't blow up compile times.
First chapter of Kernighan and Donovan's new Go book [pdf]
191–200 of 233 posts
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#192Earlier quoted context omitted.
This is one of the things I like about Go: it's "done." In exchange for passing on extensions that might make certain use cases easier, we'll avoid the bloat and have decades of backward compatibility. We just came out of a decade of nifty language mania. What I learned is that languages are boring but problems are interesting. Algorithms and solutions are interesting. A great solution to a challenging problem is rea…
What C compiler do you use to compile that 70s code? I find modern compilers usually choke on the "done" C code from then.
Of course, we're talking about pre-ANSI C where any function prototype without a void argument implicitly accepts any and all arguments.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#193Earlier quoted context omitted.
I'm guilty of this when writing C. I really have no desire to learn the language properly (it's hard enough to fit C++ in my brain), so I'll just follow the patterns others have set. Microsoft does stuff like: typedef struct _FOO { ... } FOO, *PFOO; Yeah ok fine, I'll do that.
When doing this in your own libraries, be sure to document how to generate the struct tag name from the typedef name. (MS don't do this - but they're not consistent about it anyway.) Then when people see a typedef'd struct used somewhere in a header, they'll know how to forward declare it in their own headers.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#194Would Go provide a viable alternative to C++ for numeric and computer graphics 'kind of stuff'? I have no problem with C++ but the better-than-python proclamations got me intrigued.
D is a viable alternative for C++; you still get to enjoy near native performance and cleaner FFI compared to Go, without giving up the features of a modern programming language.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#195Can people post their opinions on static linking of go binaries? Doesn't it result in increased size of runtime binaries when compared to those generated by C/C++?
I love being able to pull down a docker container that fast!
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#196Earlier quoted context omitted.
> no default parameter values Hearing this leaves a bad taste in my mouth, because one of the (mis)features I've found in Go is its implicit default value in struct initialization. In Go, you don't get a compile error when you miss some fields while initializing a struct. e.g. type T struct { a int b string c float64 } t := T{c: 1.5} will happily set `t.a` to 0 and `t.b` to an empty string. While this is useful for m…
I should explicitly state I seem to be in the minority in the Go community here, but: You don't get a compiler error if you initialize by name. You do get a compiler error when you initialize by position. In my minority opinion, you can and should use that to your advantage whenever possible. Some structs are clearly "configuration-like", for instance, and you don't want an error if a new option shows up, which will…
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#197To those in the Go community: - What is Go well suited for other than network programming? - Why might one decide to write the backend API of their web app in Go, compared to say Grails, Python etc.
> What is Go well suited for other than network programming? Why might one decide to write the backend API of their web app in Go, compared to say Grails, Python etc. You'll get a lot of different opinions on this. I'll just speak based on my experience, since Python was my primary language before coming to Go. Everything I used to use Python for, I can do faster in Go. The notable exception to this is statistical an…
Well, you came to the wrong place...
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#198To those in the Go community: - What is Go well suited for other than network programming? - Why might one decide to write the backend API of their web app in Go, compared to say Grails, Python etc.
Apart from the already mentioned reasons, another one would be maintainability. Go was designed with this in mind and some of its shortcomings come from this approach. It is a relatively small language, with one way of doing a certain thing and a mandate of using standard libraries and strict code formatting. It sounds limiting but it is productive and makes every Go developer write in the same style. So whether it i…
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#199Earlier quoted context omitted.
> Basically they dismissed every implemented approach, despite generics obviously working in other systems. But working at a price. And Go isn't willing to pay the price (especially in terms of compile time). If Go ever adds generics, it will be with a new approach that doesn't blow up compile times.
I wonder how much developer time is spent due to a lack of generics. Developer time costs more than compiler time.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#200Earlier quoted context omitted.
I wonder how much developer time is spent due to a lack of generics. Developer time costs more than compiler time.
Slow compilers waste developer time.
Go is only unique in that it can do a complete recompile in very attractive times. The only hitch, of course, is that you sacrifice features known and loved in other languages for over a decade.