Live data from Hacker News

Seven years of Go

blog.golang.org

241–250 of 318 posts

Re: Seven years of Go

#241

Earlier quoted context omitted.

I miss generics, not because I would write new generic functions all the time, but because a few key generics provide infrastructure that increases the beauty of programs dramatically. The problem is this: Have you ever worked in a mature codebase with generics, where they haven't somehow been overused? Please tell me where that is!

Yes, constantly. I've rarely seen generics overused.

Send me contact info.

Re: Seven years of Go

#242

Earlier quoted context omitted.

Only if the cost-benefit works out, and there isn't a better solution.

And that's clearly the case with generics.

You're seriously saying that generically? All languages should simply have them? Not so sure you should dismiss the context like that.

Re: Seven years of Go

#243
post #195

Earlier quoted context omitted.

> it's usually for some tree-like structure, but the cases where I need a high-performance tree structure and can't take the performance hit of `interface{}` are few and far between. The problem with interface{} is that it makes it pretty much worthless to have a type system at all.

Generics in java work via type erasure, so is the same as interface{} by the time the code is running.

Absolutely not, they are not the same. Without generics, the compiler can't make any guarantees on the soundness of your code. Go will accept code that's inherently broken and that Java will simply refuse to compile. I like to catch such errors as soon as possible.

As for saying "they are the same once the code is running", well, duh, of course, but it's completely useless by then.

Re: Seven years of Go

#244

Earlier quoted context omitted.

I miss generics, not because I would write new generic functions all the time, but because a few key generics provide infrastructure that increases the beauty of programs dramatically. The problem is this: Have you ever worked in a mature codebase with generics, where they haven't somehow been overused? Please tell me where that is!

Overused in what way? Do you have an example of what you mean by that? I'm having a hard time understanding where using generics would cause problems. C++ templates, sure, but those are much more powerful than just having parametric polymorphism.

C++ templates, sure

C++ templates! I keep on running into places where I'm debugging, then I find myself in a maze formed by template overuse, then debug around that instead.

just having parametric polymorphism

I think that could be workable in Go. I can imagine how debugging that would be straightforward.

Re: Seven years of Go

#245

Earlier quoted context omitted.

> Yes, the first couple of weeks were a bit rough while I was getting used to the ownership system, but since then I have been progressing at a relatively quick pace. This is the very definition of "high barrier to entry". Clearly it wasn't too much of a barrier for you but I can see how it'd be an issue for people. I'm expecting editor support and wider adoption (differently constructed tutorials, SO answers) to low…

I can see that, but a couple of weeks of investment doesn't seem "incredibly high" to me.

It took me about a week of fairly vigorous effort to start writing it fluently, but I also have the advantage of having seen and written many other programming languages. I have a few anecdotal examples of friends who are great developers, but still have trouble with Rust's ownership system.

When I say something like "incredibly", it's after thinking about trying to teach it someone more junior (like you'd see in a corporate environment with a mix of skill levels). I think that this would be a very difficult task.

Re: Seven years of Go

#246

Earlier quoted context omitted.

> The problem with interface{} is that it makes it pretty much worthless to have a type system at all. I don't understand this argument. You need `interface{}` about 1% of the time; somehow it's better to have no type checking than only 99% type checking? Even in the 1% of cases, I've literally never seen a production bug (or even a failed test case) caused by a type error. I'm sure they happen, but I doubt they happ…

Except the 99% (though in my experience more like 80% of the cases where generics would be considered in other languages) of the time you are refraining yourseld from using interface{} and perhaps choosing another bad solution (lesser of the evils)

I don't think this is true in any meaningful sense. Perhaps you're talking about map() and friends, but these are so trivial that it's just as well to write out the for loop.

Re: Seven years of Go

#247
post #220
post #211

Earlier quoted context omitted.

If you're doing that all over the place, you're doing it wrong. I've never seen Go code that looks like that in real projects.

> If you're doing that all over the place, you're doing it wrong. I've never seen Go code that looks like that in real projects. Yet it is there in the language. Why is that? how do you justify adding this to a statically typed language?

Your position is that statically typed languages shouldn't have reflection? I think that's a pretty fringe position to take that not many programmers would agree on. The JVM and .NET static typed languages have reflection, C++ will (hopefully) get reflection one of these days soon as it's been talked about for a while. Even rust has reflection. I think statically typed languages without reflection are the exception rather than the norm.

Re: Seven years of Go

#248
post #208
post #191

Earlier quoted context omitted.

>C++ doesn't have reflection How would you describe RTTI?

Can you create adhoc types from nothing with RTTI ? because in Go you can, at runtime. Is it what a statically typed language which community claims generics are unnecessary should prioritize as a feature ? runtime magics ? really ?

So your argument goes no deeper than, "(Say stuff that might sound bad on the surface) Really?" Can you be more substantive than appeals to prejudice? (For a change)

Re: Seven years of Go

#249
post #237

Earlier quoted context omitted.

Most of the times we couldn't do the refactorings/changes we wanted to, it was because we could only be 99.9% sure and not 100% sure someone didn't stick some goofy value somewhere to denote something special. Also, I'm not so sure that Smalltalk as a language community and as a programming environment did what it took to get everyone to do the right thing. In Swift, it seems like the programmer would quickly learn t…

Interesting point about refactoring and "doing the right thing", didn't think about that angle, thanks for the reply!

You're welcome. The stuff that's actually important in production code over years is often something hard to think of ahead of time while looking at toy programming examples. And often, it involves what humans might do under deadlines.

Re: Seven years of Go

#250

I've had a little exposure to Go and seen how rapid development in Go can be while still maintaining decent performance. Is anyone aware of scientific stack development in Go? Specifically, does HN think thee will be a Numpy or Scipy equivalent in Go or does this not make any sense?

There are people who are working on this. There is an active data science community using go. I would start here:

https://github.com/gopherds/resources

Post reply on HN