News for hackers. Stuff that matters.
Re:Four days of Go by adrusi on Wednesday April 22, 2015 @11:47AM (#9421256)
In before "but adding generics does not make team projects harder, look at language ..."

Your (and many other people's) insistence on dismissing discussion regarding generics as some kind of a joke is anti-intellectual. You're rejecting valid criticism of your arguments on the basis that the critic's argument is unworthy of attention for some reason external to the discussion at hand.

I agree that pro-generics arguments are usually boring, and at least 90% of what they say has been heard before. But the same can be said of Go evangelism, like your comment; they are no less worthy. Please don't deliberately shut down discussion.

Re:Four days of Go by nemothekid on Wednesday April 22, 2015 @01:25PM (#9421984)
I don't even get the vitriol against generics - the designers have only taken a "not now" approach to the subject and everyone acts as if Go is a social experiment to get everyone mad about generics.

Then people bring Rust, which has only had a stable grammar for last couple months and a standard library nowhere near Gos. Would it be wise to complain that the Rust stdlib doesn't contain a HTTP server implementation?

Re:Four days of Go by wwweston on Wednesday April 22, 2015 @03:01PM (#9422743)
It's not just the "not now" approach. It's the rhetoric that often goes along with it. The author of this piece picks up on it when he talks about the "we've already thought about this and we're tired of talking about it" vibe, though I might characterize a lot of the discussion around generics from the Go community at large more specifically as "you think you want/need this, but trust us, you don't, and the inconveniences you think you're experiencing are just not that big a deal, particularly compared to the inconveniences you'll experience if we do add it."

And yes, if not having an HTTP server implementation in the stdlib seems like it makes your project difficult, that's a perfectly reasonable criticism of Rust.

(Though one I suspect will get resolved much more quickly and cleanly than issues like generics in Go.)

Re:Four days of Go by steveklabnik on Wednesday April 22, 2015 @03:59PM (#9423151)
> I suspect will get resolved much more quickly and cleanly

It's pretty easy. You just add this line to your Cargo.toml:

    hyper = "0.3.14"
And the next time you build, Cargo handles everything. You can now use hyper like any other library that's included with Rust, no biggie.

This is one reason we've chosen minimalism for the standard library: It's really easy to use external libraries, and once things land in the standard library, they often don't improve much. The versions become tied to the compiler versions, contributors now need to build the entire compiler rather than just working on a single library, and everything else. We've already seen three distinct major HTTP implementations happen, had we put rust-http right in the standard library, we'd have frozen something the author has already deprecated!

Choosing non-minimalism has advantages too: in this scenario, you need to know that hyper is currently the best library, for example. Engineering is all about trade-offs.

(Solely chiming in on the HTTP in Rust thing here. I found the part of the article about the Gopher... lacking, and it distracted me from the rest of the author's points.)

Re:Four days of Go by EugeneOZ on Wednesday April 22, 2015 @05:28PM (#9423701)
no. there is a HUGE difference between std lib and third-party libs. Std lib is like a contract - maintainers of language have to keep all parts up to date and working. Maintainers of third-party library can write "Farewell Rust" blogpost and all projects, based on that library will be in trouble. And as http is a very important thing for web-programs, it's much better to see support of http in std lib.
Re:Four days of Go by pcwalton on Wednesday April 22, 2015 @06:38PM (#9424036)
> Std lib is like a contract - maintainers of language have to keep all parts up to date and working.

Rust has language stability (in practice right now, and officially once we hit 1.0 in a month), so we in fact do guarantee this.

> Maintainers of third-party library can write "Farewell Rust" blogpost and all projects, based on that library will be in trouble.

Languages can do that too, in which case the entire language and its ecosystem is in trouble. Anything can be abandoned. The crucial thing is that if a piece of infrastructure is in the standard library, then it's much harder and slower to iterate on it. HTTP is a fast-moving standard (see HTTP 2, for example), and so it's very important to be able to iterate quickly to support new features.

> And as http is a very important thing for web-programs, it's much better to see support of http in std lib.

I disagree. Web applications need HTTP, but many applications aren't Web applications. As a example on the far opposite end of the spectrum, your OS kernel doesn't have an HTTP stack in it (unless you happen to be running something like khttpd), and Rust is designed to be usable for OS kernels. Large standalone standard libraries reduce flexibility, and Rust is designed to be flexible.

Re:Four days of Go by comex on Wednesday April 22, 2015 @09:05PM (#9424471)
Hmm... Windows has part of a HTTP stack in the kernel, which I know solely based on hearing about the recent vulnerability in it. And OS X's kernel, IIRC, can load disk images over HTTP for netboot purposes. That leaves Linux as the odd one out :)

(Yes, I know that's completely tangential to the point you're making.)

Re:Four days of Go by EugeneOZ on Thursday April 23, 2015 @01:16AM (#9425119)
> Languages can do that too

Languages can abandon own std lib? Keep away from such languages.

> HTTP is a fast-moving standard (see HTTP 2, for example), and so it's very important to be able to iterate quickly to support new features.

Golang doing it just fine, so Rust can too.

> I disagree. Web applications need HTTP, but many applications aren't Web applications.

I'm talking exactly about web applications, not about all applications. And if web applications is not the field of Rust - let us know about it. Right now is not obvious and even web frameworks exist in Rust.

Re:Four days of Go by adrusi on Thursday April 23, 2015 @10:01AM (#9426689)
Languages can abandon own std lib? Keep away from such languages.

Not abandon their stdlib. Be abandoned. There is nothing more preventing developers of the compiler/vm from abandoning their efforts than the developers of a library. It would make little sense for developers of the language to abandon just the stdlib, as it is part of the language.

I'm talking exactly about web applications, not about all applications. And if web applications is not the field of Rust - let us know about it. Right now is not obvious and even web frameworks exist in Rust.

Rust is a fine language for web applications, but it's not designed specifically for them. The languages with huge stdlibs date from a time when accessing libraries was much harder than it is today. The internet, as well as package management, was young when Python and Java were born. Now that it's easy to download packages, and we have reasonably passable tools for doing so, there's no need for heavy standard libraries.

Go is specially designed for running on servers and performing network tasks. So it makes sense that it would have a stdlib with rich networking support, including http.

Node was designed as a frontend to libuv, to make nonblocking IO easier to use. The most visible domain where nonblocking IO is extremely useful is in making web applications, AND the fact that it's javascript makes it even better suited to web. So Node has http support baked in.

Rust is meant to exist in the same space as C++. It can be used for anything. OS kernels to text editors to web applications. There is nothing in particular that ties it to any of these domains. It has the option of putting support for all of these in the standard library, which would make it hard to maintain. Every time one part of the stdlib needs to change, the language needs a minor version bump, or there's a delay before anyone can use the new libraries. Not a big deal when you only have one or two domain specific components in the stdlib, but a problem when you have twelve.

If the stdlib supported only some specific domains, it would give people from other domains the impression that they're second class, and drive them away. Not cool.

So rust goes for a minimal stdlib.

Re:Four days of Go by EugeneOZ on Thursday April 23, 2015 @02:12PM (#9428649)
Language can be abandoned, but it's pointless argument, sorry. When language is abandoned, there's no reasons to argue about any aspect of that language.

In second part of your comment you comparing stdlib and external libs as they are equally reliable, but my point is exactly about difference in this aspect. I agree stdlib shouldn't be swiss knife, but I disagree it shouldn't have nothing except minimal set to serve language constructions. Go was designed as C++ also, not only for networking. And it has image module, not only http (for example). I see how fast and successfully Go evolving, I think Rust is better and that's why I think it's the area where Rust can take better idea from Go.

Re:Four days of Go by steveklabnik on Wednesday April 22, 2015 @05:45PM (#9423792)
Right. That's the kind of thing I meant with "Choosing non-minimalism has advantages too."
Re:Four days of Go by threeseed on Wednesday April 22, 2015 @09:00PM (#9424460)
I would argue that Rust's approach is perfectly fine so long as they have strong organisational support around third party libraries. Look to Java for how to do this. Many core Java libraries are managed by Apache or Eclipse e.g. HTTPClient who manage the process around open source projects.

HTTP clients are not something I would want in a standard library to be honest. Since there are so many different ways to implement them. And not all work for all use cases. It's not the same as StringUtils or ArrayUtils.

Re:Four days of Go by jrobn on Wednesday April 22, 2015 @09:56PM (#9424606)
Why not let a bunch of third party HTTP libraries pop up. Eventually things will converge on the "best" library for doing http in rust. Open a discussion and start adding great third part libraries to the std lib. The challenge then would be keeping this coherent throughout the std lib.
Re:Four days of Go by EugeneOZ on Thursday April 23, 2015 @01:21AM (#9425125)
Not sure why you think I don't want to let libs pop up. I just ask for http module in std lib, not as the only implementation which can exist, but as "last resort", always working, in any new version of language, supported and tested by core team maintainers. Not full-featured thing with routes and other whistles and belts, just basic things.
Re:Four days of Go by cgag on Wednesday April 22, 2015 @10:23PM (#9424669)
Haskell does it the way Rust does and it's pretty frustrating to have tons of solutions to evaluate for everything you want to do. Maybe crates.io will have a better discovery story, or rust will have a larger user base that makes it more likely that there's a clear winner. I hope so.
Re:Four days of Go by cryptos on Wednesday April 22, 2015 @04:14PM (#9423241)
> Engineering is all about trade-offs.

What a wonderful sentence about a simple, but often forgotten truth!

Re:Four days of Go by MichaelGG on Wednesday April 22, 2015 @06:54PM (#9424095)
> I don't even get the vitriol against generics - the designers have only taken a "not now" approach to the subject and everyone acts as if Go is a social experiment to get everyone mad about generics.

I don't use Go so I don't really care about their generics or lack thereof. What I found ... odd ... is how the Go team has apparently said they can't go generics because there's no good way to implement them. Seems like a strange thing to say when many languages are happily using them.

Re:Four days of Go by ecnahc515 on Wednesday April 22, 2015 @07:30PM (#9424225)
Implicit interfaces make generics a lot less trivial to implement. They also don't want to simply add an existing approach with bad trade-offs (see C++ templates). Likewise, adding a runtime based multi-dispatch based generic system is not much better than what we already have.

Lot's of languages have generics, but they have trade-offs, so they aren't free, even if they can implement them using existing generics implementations. Picking what they're willing to sacrifice can be hard, even if it's something like slower compile times.

Anything backwards compatible has to be in Go 2 or later, because generics are hard to make backwards compatible, we'll have to wait.

Re:Four days of Go by barosl on Wednesday April 22, 2015 @07:10PM (#9424164)
After hacking Rust, I got the feeling that generics are hard. They are so hard that a language should consider them from the beginning to fully take advantage of them. That might be the reason why the Go team says generics are hard to implement in the current Go type system. They can also choose either C++-like code generation based on templates, or external code generating tools, but both are not perfect in my opinion.
Re:Four days of Go by Scarbutt on Wednesday April 22, 2015 @01:41PM (#9422100)
Rust's stdlib not containing a HTTP server is a deliberate act.
Re:Four days of Go by ori_b on Wednesday April 22, 2015 @01:48PM (#9422132)
Go not including generics is a deliberate act.
Re:Four days of Go by heinrich5991 on Wednesday April 22, 2015 @04:12PM (#9423229)
A web server can easily be implemented as a library, generics are a language feature.
Re:Four days of Go by EugeneOZ on Wednesday April 22, 2015 @05:34PM (#9423735)
And library can be easily abandoned or just be broken after breaking changes in next version of language, and you will have to wait couple of months, while this issue will be solved. Or just fix all the things yourself.
Re:Four days of Go by pcwalton on Wednesday April 22, 2015 @06:38PM (#9424034)
> after breaking changes in next version of language

In practice Rust doesn't make breaking changes anymore. (It hasn't since beta, and in a month or so 1.0 will be declared officially stable and it will become forbidden to make them.)

Re:Four days of Go by heinrich5991 on Wednesday April 22, 2015 @05:44PM (#9423785)
Just fixing the language is not possible without major problems though.
Re:Four days of Go by aikah on Wednesday April 22, 2015 @10:59PM (#9424789)
it's not a "not now" approach, they are simply not going to add any new significant feature to the language (source : https://thechangelog.com/148/?utm_content=bufferf8f9d&utm_me... ) . Go will not have generics at all.

People don't want generics for the sake of it, they want type safety.

Re:Four days of Go by PopsiclePete on Wednesday April 22, 2015 @05:42PM (#9423769)
Various core Go team members seem to have a different philosophy regarding generics. They actually don't have a united front on this.

It seems Russ Cox and Rob Pike are either anti-generics or in the you-dont-really-need-them camp, but Ian Thompson and Brad Fitzpatrick have seemed very open to the idea - what they can't, however, agree on, is exactly how to implement them so that they make sense in Go. That's it.

If you or anyone out there manages to produce a proposal of how they should work/look like and even a fork of Go implementing the idea, it will be taken seriously, at least by some core Go members.

I have a feeling that generics are coming. And I have a feeling they'll be very Go-like - an external tool with code generation, not special syntax. Just my 2 cents.

Re:Four days of Go by barosl on Wednesday April 22, 2015 @07:21PM (#9424199)
I think adding generics to a stable language is actually a hard thing to do. There's more than "that's it". Rust has had many major and minor changes regarding generics solely, which has broken backward compatibility each time.

The Go team may find a brilliant way to accomplish this, but I think the only viable way left is, as you said, using code generation. Either C++-way, which is a special syntax but still a form of code generation, or an external tool. But neither of them is elegant, because you cannot fully utilize the convenience that the type system give. These might be the concerns that the Go team has.

Re:Four days of Go by PopsiclePete on Thursday April 23, 2015 @02:49PM (#9428936)
Maybe the "elegance" is a factor as well, but I haven't seen it mentioned. All I've seen mentioned is: a) can't change syntax b) can't take huge performance hits at run time or at compile time c) can't break backwards compatibility d) talk is cheap - provide a working implementation

So far, nobody has been able to show all 4 of these requirements, so nothing has been done.

But when/if someone does, I expect it to be taken very seriously.

Re:Four days of Go by amaranth on Wednesday April 22, 2015 @07:27PM (#9424214)
This is already a thing, no? https://blog.golang.org/generate
Re:Four days of Go by PopsiclePete on Thursday April 23, 2015 @11:56AM (#9427570)
Almost. So close. But no cigar. Go generate is for the package creator, not the package consumer. So you, as a package creator, may create a "generic" red-black tree, but unless you pre-generate all my use cases for all my data types, I can't pull your package and then use go generate to create Tree<int> and Tree<string> if that makes sense.
Re:Four days of Go by howeyc on Wednesday April 22, 2015 @05:09PM (#9423557)
That comment was there because my point was not about generics, but about programming language features (that are must have, the must have list of course being different for everyone) in general.