5 ms·
Go has probably the most extensive stdlib of major languages outside of Python (happy to be corrected on that). You can get a sense for what is available by loo
by bit_flipper 4y ago
Go has probably the most extensive stdlib of major languages outside of Python (happy to be corrected on that). You can get a sense for what is available by looking here: https://pkg.go.dev/std https://pkg.go.dev/std. There is also the "pseudo stdlib" that is maintained by the Go project but for one reason or another is not available in the stdlib currently: https://pkg.go.dev/golang.org/x https://pkg.go.dev/golang.org/x
- donio 4y agoNo "outside of Python" qualifier needed.
- kaba0 4y agoJava seems to have just as much if not more available in its standard lib.
- derkades 4y agoThough some modern features are lacking, like a JSON parser or web server.
- tazjin 4y agoIt does contain several Javascript (!) interpreters, so you could probably glue those together as a JSON parser :)
- kaba0 4y agoIt does have a web server: https://openjdk.org/jeps/408 https://openjdk.org/jeps/408
- philosopher1234 4y agoDoes anyone actually use it? I’ve never even heard of this thing and I’m a professional Java dev
- simiones 4y agoGiven that it was only added in Java 18 and it is a simple static file server (no way to run custom code when serving a URL), I don't think it's in any way widely used at the moment. Edit: or will ever be. It is definitely explicitly not an equivalent of go's net/http. Indeed, there is probably never going to be an equivalent of net/http in the Java stdlib (since they prefer to rely on the user choosing one of the existing server frameworks, such as Jetty).
- philosopher1234 4y agoFrom your description it sounds like it is a completely different beast from net/http
- simiones 4y agoYes, per the JEP that was linked, it is only intended as a toy server for quick example code, essentially: > Provide a command-line tool to start a minimal web server that serves static files only. No CGI or servlet-like functionality is available. This tool will be useful for prototyping, ad-hoc coding, and testing purposes, particularly in educational contexts. > It is not a goal to provide a feature-rich or commercial-grade server. Far better alternatives exist in the form of server frameworks (e.g., Jetty, Netty, and Grizzly) and production servers (e.g., Apache Tomcat, Apache httpd, and NGINX).
- dmux 4y agoThe specific web server in the JEP is relatively new, but there has been an http server implementaion since 1.6: https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpServer.html https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...
- simiones 4y agoCool, I had no idea about this. I see it's still available after the modularization effort, and it is: https://docs.oracle.com/en/java/javase/18/docs/api/jdk.httpserver/module-summary.html https://docs.oracle.com/en/java/javase/18/docs/api/jdk.https...
- doctor_eval 4y ago> It is not a goal to provide a feature-rich or commercial-grade server. That server is not remotely comparable to the one in Go.
- deleted 4y ago[deleted]
- pjmlp 4y agoIt is tailored for the same purpose as Go's one, hello world.
- simiones 4y agoGo's net/http is essentially the only used Go HTTP(S) server. It is often wrapped with other libs to add things like request routing, but it is always used as the actual HTTP implementation. Not sure why you're saying its purpose is "hello world". The Java one is not usable in anything beyond hello world, and is explicitly not intended to be.
- pjmlp 4y agoThe fact that is lacks any kind of administration console, and security integration with enterprise connectors shows it is at hello world level.
- simiones 4y agoAs someone maintaining a pretty large networking industry proprietary app based entirely on net/http in terms of any kind of HTTP communication, I feel like I can easily tell you are wildly exaggerating. Admin consoles and enterprise connectors are entirely irrelevant to many uses of an HTTP server. Hell, even Kubernetes' API server is built using net/http.
- pjmlp 4y agoYet many of those depend on having something like Apache, NGIX, HA Proxy, IIS,... taking care of the actual load.
- dmux 4y agoJava has had a basic http server built in since 1.6 https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpServer.html https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...
- pjmlp 4y agoNot as Java and .NET.
- zendist 4y ago.NET is a strong contender, I would say. The standard library is immensely useful, and many things you may wonder if you need are available as Nuget packages, coming from the same devs who build the std lib.
- metaltyphoon 4y agoGo probably pales in comparison to .NET [0]. Its about 1 million APIs [0] https://apisof.net/ https://apisof.net/
- yencabulator 4y agoHell, I'll argue Go standard library is more extensive and better than Python's. Case in point: HTTP. The batteries included in Python definitely reflect the era of their creation.