News for hackers. Stuff that matters.
Re:Go is Google's language, not ours by pa7ch on Wednesday May 22, 2019 @02:39AM (#19978414)
Many like Go because it is an opinionated language. I'm not sure that a 'community' run language will create something like that because there are too many opinions. Many claim to represent the community, but not the community that doesn't share their opinion. Without clear leaders I fear technical direction and taste will be about politics which seems more uncertain/risky.

I like that there is a tight cohesive group in control over Go and that they are largely the original designers. I might be more interested in alternative government structures and Google having too much control only if those original authors all stepped down.

Re:Go is Google's language, not ours by rob74 on Wednesday May 22, 2019 @03:32AM (#19978741)
My thoughts exactly! It's important to have a community and to work with it, but, especially for a programming language, there has to be a clear concept of which features should be implemented and which not - just accepting community contributions for the sake of making the community feel good would be the wrong way. Otherwise you end up with a feature monster like innumerable other programming languages, and that's exactly what Go doesn't want to be.
Re:Go is Google's language, not ours by sam_lowry_ on Wednesday May 22, 2019 @03:56AM (#19978923)
Go is somewhere in the middle of the spectrum between Lua (dictatorship) and C++ (endless politicking).
Re:Go is Google's language, not ours by baby on Wednesday May 22, 2019 @11:05AM (#19981964)
My fear is that they end up integrating generics just to please some vocal group of java/c++ programmers.
Re:Go is Google's language, not ours by theshrike79 on Wednesday May 22, 2019 @02:49AM (#19978475)
In my opinion the way they are handling adding Generics to Go is proof of this model working.

They are actually trying to pick the implementation that solves real world issues, not just trying to tick [x] Generics in the Go spec sheet.

Re:Go is Google's language, not ours by crimsonalucard on Wednesday May 22, 2019 @02:58AM (#19978529)
Parametric polymorphism is a real world issue. The fact that it wasn't checked off indicates to me that they are of the opinion that it's not as important.

It's ok to have this opinion, I just disagree with it. I do agree that it's important to think it through, I do not agree that the language should be brought to 1.0 without it.

Re:Go is Google's language, not ours by B-Con on Wednesday May 22, 2019 @03:06AM (#19978580)
This is the general point though. Community pressure would have produced generics under a different leadership model that wants to check the box.

Whether this is the right decision for this specific issue is a different story. But the fact that they aren't checking boxes for the sake of it is evidence of this style WAI.

Re:Go is Google's language, not ours by chrisweekly on Wednesday May 22, 2019 @08:12AM (#19980267)
WAI?
Re:Go is Google's language, not ours by alach11 on Wednesday May 22, 2019 @10:35AM (#19981607)
I would guess Working As Intended.
Re:Go is Google's language, not ours by nnq on Wednesday May 22, 2019 @03:02AM (#19978550)
> Parametric polymorphism is a real world issue.

...what in the world makes you thing that? I love parametric polymorphism, but nothing stops you from writing the most complex computer programs you can imagine without it.

Re:Go is Google's language, not ours by calcifer on Wednesday May 22, 2019 @03:07AM (#19978594)
> but nothing stops you from writing the most complex computer programs you can imagine without it.

Sure, you can do that with punch cards as well, but there is a reason we've collectively moved beyond them.

Re:Go is Google's language, not ours by masklinn on Wednesday May 22, 2019 @03:39AM (#19978796)
> ...what in the world makes you thing that?

Go literally special-cases generic builtins because they couldn't be arsed to properly implement it but knew nobody would accept completely untyped core collections.

Re:Go is Google's language, not ours by foldr on Wednesday May 22, 2019 @06:20AM (#19979641)
Go does not have generic arrays any more than C does. You cannot e.g. write a generic Go function to reverse an array.

You seem to be conflating type-parameterized collections with generics. You can use generics to implement type-parameterized collections, but it doesn't really make sense to think of type-parameterized collections as a form of generics unless you can actually abstract over the type parameters (which you can't in Go).

Re:Go is Google's language, not ours by masklinn on Wednesday May 22, 2019 @06:45AM (#19979751)
> Go does not have generic arrays any more than C does.

Go does have generic collections, and generic functions operating on these collections.

> You cannot e.g. write a generic Go function to reverse an array.

You can if you're part of the core team and implement them as builtins. Go doesn't have userland generics, because users of Go are peons who can't be trusted with sharp implements.

> which you can't in Go

Because the core Go team assumes and asserts users of Go should not and can not be trusted with anything more complex than a wooden cube with rounded edges large enough that it can't fit in their mouths.

Re:Go is Google's language, not ours by dang on Thursday May 23, 2019 @04:08AM (#19989587)
Would you please drop the nasty rhetoric and not do programming language flamewars on HN? They lead to harsher, dumber discussion, and ultimately cause a forum to destroy itself. Learning from those past lessons was one of the motivations for starting Hacker News years ago, and it's not like we want to forget them now.

Edit: we've had to ask you half a dozen times in the past not to post aggressively and uncivilly on HN. Would you please fix this? Reviewing the site guidelines should make it clear what we're looking for instead.

https://news.ycombinator.com/newsguidelines.html

Re:Go is Google's language, not ours by foldr on Wednesday May 22, 2019 @06:57AM (#19979816)
According to this usage, C has generic functions because you can, e.g., index into an array of ints. The whole point of generics is that the language makes available some form of abstraction over types. Go does not have this feature. It has some built-in operators that can operate on multiple types. Most languages have this. The arithmetic operators in C, for example, can take operands of many different types. This is not "generics".

>Because the core Go team assumes and asserts users of Go should not and can not be trusted with anything more complex than a wooden cube with rounded edges large enough that it can't fit in their mouths.

This can't really be the right explanation given that generics are now being added to the language. In any case, this kind of mean-spirited speculation about people's motives is borderline trolling, IMO. The Go team have publicly stated their reasons for not (initially) putting generics in the language. Unless you have some inside info suggesting that they're lying, I'd refrain from saying this kind of thing.

Re:Go is Google's language, not ours by masklinn on Wednesday May 22, 2019 @07:46AM (#19980092)
> The whole point of generics is that the language makes available some form of abstraction over types. Go does not have this feature.

Go absolutely has this feature. Just not for you as a user of the language.

> It has some built-in operators that can operate on multiple types.

Go has multiple builtin functions which abstract over type parameters e.g. close() can operate on any chan, append() or copy() can operate on any slice. They are not operators (symbolic or keyword).

> Most languages have this. The arithmetic operators in C, for example, can take operands of many different types. This is not "generics".

It's overloading, +(int, int) and +(double, double) are separate functions under the same symbol. It's an orthogonal feature, so much so that there are plenty of languages which do have userland generics and don't have overloading.

> This can't really be the right explanation given that generics are now being added to the language.

The core team has been saying they're considering the feature / issue pretty much since the language was first released. You'll have to excuse me if I don't hold my breath.

Re:Go is Google's language, not ours by foldr on Wednesday May 22, 2019 @08:08AM (#19980239)
>Go absolutely has this feature. Just not for you as a user of the language.

That seems like a roundabout way of saying that it doesn't have the feature.

>It's overloading

You could just as well regard Go's close, append, copy etc. as overloaded.

> The core team has been saying they're considering the feature / issue pretty much since the language was first released. You'll have to excuse me if I don't hold my breath.

They've come out with a specific generics proposal. I'm not sure why you would think that they're not serious about implementing it.

Re:Go is Google's language, not ours by grumpydba on Wednesday May 22, 2019 @11:54AM (#19982506)
> You can if you're part of the core team and implement them as builtins. Go doesn't have userland generics, because users of Go are peons who can't be trusted with sharp implements.

It looks like you are in golang core team's minds. You appear to be able to judge intent. Impressive quality you have here.

Re:Go is Google's language, not ours by masklinn on Thursday May 23, 2019 @01:47PM (#19994054)
> It looks like you are in golang core team's minds. You appear to be able to judge intent.

Not at all, Rob Pike stated it fairly explicitly if in somewhat milder terms:

> The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.

Re:Go is Google's language, not ours by grumpydba on Saturday May 25, 2019 @07:22PM (#20012123)
> users of Go are peons who can't be trusted with sharp implements.

Pike himself is a user.

Re:Go is Google's language, not ours by _ph_ on Wednesday May 22, 2019 @03:22AM (#19978675)
But that is exactly the point - you would have added the best proposal available to the language vs. waiting till all issues are worked out with generics. Go 1.0 has been released 7 years ago, in that time a ton of happy Go users were able to use Go as it is. All the discussions on generics clearly show, that the Go team is interested adding them, but that all proposals so far had distinct shortcomings.

Personally, I am very happy with what Go offers today, I would rather keep a small and simple language, which allows me to concentrate on doing work, rather than trying to keep up with features added to the language. I am not even sure, I want generics to be added to the language, until they come up with a really great concept which maintains the simplicity of the language.

Re:Go is Google's language, not ours by pjmlp on Wednesday May 22, 2019 @04:40AM (#19979148)
ML (1973) and CLU (1975) introduced generics to the world, followed by a myriad of approaches to implement them across multiple languages, so plenty of time.
Re:Go is Google's language, not ours by _ph_ on Wednesday May 22, 2019 @05:00AM (#19979251)
No one claimed, that languages with generics don't exist. But if you follow the discussion about generics in Go, Russ Cox did a thorough discussion of all the proposals on the table and why they would mean giving up some of the core traits of the Go language. As soon anyone suggests an implementation not colliding with the core Go goals, the Go team probably would pick it up quickly.

Or phrased it in another way: with all the years of experience on generics, they still got them wrong when implementing generics for Java, e.g. with the type erasure.

Re:Go is Google's language, not ours by pjmlp on Wednesday May 22, 2019 @06:15AM (#19979613)
Not at all, he focused on how Java and C++ do it, and later on the Go 2.0 proposal admited that they were a bit closed minded to look for how other language implementations work.

"In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier."

https://go.googlesource.com/proposal/+/master/design/go2draf...

Re:Go is Google's language, not ours by crimsonalucard on Wednesday May 22, 2019 @09:10PM (#19987362)
This is definitive proof that the lack of generics was a mistake from the beginning.
Re:Go is Google's language, not ours by throwaway34241 on Wednesday May 22, 2019 @04:12AM (#19979012)
I'm not sure what GP meant by real world issues, but they do have some specific constraints that they want their implementation of generics to achieve, one of the core team members tried to nail down the details over a period of years but there were issues with the previous proposals before the latest one. So I don't think the issue is parametric polymorphism or not, it's more about things like keeping fast compile times, avoiding boxing value types, etc.
Re:Go is Google's language, not ours by xyproto on Wednesday May 22, 2019 @03:20AM (#19978658)
Parametric polymorphism is a tool to solve real world issues with.

It is not unthinkable that there could exist other programmatic tools that would be able to solve the same real world issues.

Re:Go is Google's language, not ours by karmakaze on Thursday May 23, 2019 @01:49AM (#19988857)
The one thing that I do like about Go not having generics early on is that it became a language for lower-level work with many good libraries. I wouldn't quite call it a systems language like they like to say but I like its positioning which filled a void.

Now when Go 2 gets generics it will be used for all kinds of applications and frameworks, which is fine but isn't really filling a void. I expect the ergonomics (e.g. wicked fast compiles to single binary) to be better than current app dev langs. I stopped using Go and look foward to trying it again. Even then I don't think it will be one of my favorites and likely used for smaller work. Long-term I want Pony to succeed. Medium term I'll take Kotlin, Elixir, or Dart.

Re:Go is Google's language, not ours by baby on Wednesday May 22, 2019 @11:05AM (#19981974)
It would objectively have made Golang harder to read. Can we agree on that? People tend to abuse generics.
Re:Go is Google's language, not ours by erik_seaberg on Wednesday May 22, 2019 @02:29PM (#19984033)
Uses of https://golang.org/pkg/sync/#Map are objectively harder to read than if they allowed a library to implement a type that conforms to builtin map[K]V. Instead you have to learn method names and cast return values, and builtin maps don't even support those methods.
Re:Go is Google's language, not ours by baby on Thursday May 23, 2019 @01:57AM (#19988887)
Let’s agree to disagree. Maybe you’re used to reading generics after years of doing it.
Re:Go is Google's language, not ours by ehsankia on Wednesday May 22, 2019 @03:05AM (#19978578)
Is there any example of a successful large open source project that's truly lead by the community, and not a handful of people that decide what goes in and what doesn't? What would such a model even look like?
Re:Go is Google's language, not ours by PrototypeNM1 on Wednesday May 22, 2019 @02:00PM (#19983704)
I think the key component of such a model is a clearly communicated method where the community can participate in the project direction, and evidence that the method is being respected. It's been brought up in this thread but Rust's governance/RFC process comes to mind. https://www.rust-lang.org/governance
Re:Go is Google's language, not ours by kkarakk on Wednesday May 22, 2019 @03:26AM (#19978705)
you can see it already on github - survival of the fittest fork
Re:Go is Google's language, not ours by Cthulhu_ on Wednesday May 22, 2019 @04:56AM (#19979226)
In theory yes, in practice though, there's a lot of projects where the lead maintainer has vanished or doesn't spend a lot of time on it anymore making the future of the whole project and its forks debatable. Most forks aren't interested in taking the lead. The only exception I can think of was the nodejs fork, IO.js, which ended up being more of a political move and a kick up the arse for the Node team. A similar kick was given to the NPM team when Yarn started making waves.
Re:Go is Google's language, not ours by jon-wood on Wednesday May 22, 2019 @05:50AM (#19979487)
The Rails/Murb drama a few years ago is another good example I think. A bunch of people decided they didn’t like the directions Rails was going in, created a competing framework, and after proving the concept was sound ended up introducing a lot of the unique features back into what became Rails 3.
Re:Go is Google's language, not ours by fileeditview on Wednesday May 22, 2019 @03:02AM (#19978554)
Absolutely agree.. look what happened to C++ over the last decade(s).
Re:Go is Google's language, not ours by 72deluxe on Wednesday May 22, 2019 @05:05AM (#19979286)
Not sure - I thought it got significantly better with C++11/14? Admittedly it also became rather more complicated, but the changes were generally for the best I thought?
Re:Go is Google's language, not ours by lasagnaphil on Wednesday May 22, 2019 @07:52AM (#19980126)
From my five years of learning and using C++, I still have no clear picture how move semantics and rvalue references work. (I “kinda” get it, but am not confident about it). It seemed more and more convoluted every time I tried to study about it. The complexity created by implicit and explicit copy/move constructors is just insanity for me...
Re:Go is Google's language, not ours by 0815test on Wednesday May 22, 2019 @08:03AM (#19980198)
> From my five years of learning and using C++, I still have no clear picture how move semantics and rvalue references work. ... The complexity created by implicit and explicit copy/move constructors is just insanity for me...

This is the best argument for move from C++ to Rust instead. No "move constructors" whatsoever, move semantics are the default and are always performed via a trivial memcpy. There are explicit .clone() operations, like in some other languages, or the move construct can implicitly copy when the type is a POD-equivalent that makes this possible (identified by the Copy "trait"). Very simple, and nothing like the whole C++ move mess.

Re:Go is Google's language, not ours by 72deluxe on Wednesday May 22, 2019 @09:01AM (#19980657)
So what if I have an object that has a pointer to another object? memcpy is not what I want in that instance.
Re:Go is Google's language, not ours by tene on Wednesday May 22, 2019 @12:13PM (#19982698)
Assuming struct A has a reference to struct B, memcpy is a fine way to move struct A, and struct B cannot be moved while borrowed.

Here's an example I put together demonstrating this: https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:Go is Google's language, not ours by damnyou on Wednesday May 22, 2019 @12:09PM (#19982667)
If you mean intrusive data structures, Rust just doesn't support them. Everyone still manages to write software in Rust just fine. (There's some early support for immovable data with `Pin`, but that's only exposed via async/await at the moment.)

Move constructors are one of the worst parts of C++ and being able to write movable, intrusive data structures is absolutely not worth the cost. If you do need one, Rust shows that it's better to sacrifice movability than introduce move constructors.

This is not uncommon -- there are some things you can do in C++ that you simply cannot do in Rust (either safely, or at all). Usually there's another, better way to achieve the same overall goals.

Re:Go is Google's language, not ours by asveikau on Wednesday May 22, 2019 @04:42PM (#19985248)
> Move constructors are one of the worst parts of C++

Move constructors fix a narrow problem, which is, when you have something like a vector append, how do you copy over all the previous elements as a "shallow" copy rather than a deep one?

In C with realloc(), it's just assumed that memcpy works for that. With C++03 and earlier copying the elements could very well end up duplicating everything on the heap for no reason, then discarding the old copy.

How does rust do this? What I am reading from googling is that every assignment is a move?

Re:Go is Google's language, not ours by damnyou on Wednesday May 22, 2019 @06:08PM (#19986085)
Yes, every assignment of a non-Copy type is a move. (Copy types are basically primitive ones like ints, so not vectors etc.) The compiler prevents you from using the old variable at that point.

Since Rust always enforces that a move is a memcpy, a vector reallocation is just a realloc() like in C.

Re:Go is Google's language, not ours by steveklabnik on Wednesday May 22, 2019 @07:47PM (#19986845)
Safe rust may not support them, but you can use unsafe to write them. There’s a bunch of implementations of intrusive collections on crates.io.

Also, Pin is stable but async/await is not, so you’re backwards there :)

Re:Go is Google's language, not ours by Retra on Wednesday May 22, 2019 @04:40PM (#19985231)
Rust doesn't move through the pointer, it moves only the pointer, which should be perfectly fine.
Re:Go is Google's language, not ours by 72deluxe on Wednesday May 22, 2019 @09:02AM (#19980668)
Read "Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14" by Scott Meyers.

That'll clear it up for you. It's a very good book. rvalue references are a bit muddy but move semantics should be clear.

Do you have Stroustrup's blue book?

Re:Go is Google's language, not ours by szuze on Wednesday May 22, 2019 @04:32AM (#19979112)
If you give Go to the community, the community will add exceptions... yuck.
Re:Go is Google's language, not ours by josefx on Wednesday May 22, 2019 @09:09AM (#19980741)
Go already has panic/recover which where explicitly proposed as an exception like mechanism for go.
Re:Go is Google's language, not ours by BrandoElFollito on Friday May 24, 2019 @05:29PM (#20005444)
The convention in the Go libraries is that even when a package uses panic internally, its external API still presents explicit error return values. -- https://blog.golang.org/defer-panic-and-recover

I belive this means that using this mechanism similarly to try/except in Python is not possible (I write 20 lines in go so this is quite a wild guess)

Re:Go is Google's language, not ours by baby on Wednesday May 22, 2019 @11:07AM (#19981987)
And generics, ew