3 ms·
I consider the stdlib to be Go's best feature too. As a somewhat contrived example, can you name any language that lets you write a HTTP/2 TLS endpoint that com
by adtac 3y ago
I consider the stdlib to be Go's best feature too. As a somewhat contrived example, can you name any language that lets you write a HTTP/2 TLS endpoint that computes the HMAC of a PNG file's pixels without any dependencies? And if something is still missing, it's probably in golang.org/x (which is basically stdlib)!
After that, I probably consider readability at 3am [1], defer statements, explicit error handling and fast compile time to be the most important.
[1] Readability of not just your code: being able to go-to-definition into stdlib and immediately understanding it without having to grok a million unrelated decorators/FactoryFactoryFactory/std::_Vector_iterator<std::_Vector_val<std::_Simple_types<<block>>> is incredible
- afandian 3y agoJust cos I was curious and Java has a pretty good comprehensive library. - PNG: https://docs.oracle.com/en/java/javase/14/docs/api/java.desktop/javax/imageio/package-summary.html https://docs.oracle.com/en/java/javase/14/docs/api/java.desk... - HMAC - https://docs.oracle.com/en/java/javase/14/docs/api/java.xml.crypto/javax/xml/crypto/dsig/SignatureMethod.html#HMAC_SHA1 https://docs.oracle.com/en/java/javase/14/docs/api/java.xml.... You need Jetty for HTTP/2.
- crop_rotation 3y agoJava also has a comprehensive stdlib but the golang stdlib is designed so much better, and has a small number of simple and orthogonal concepts. (e.g io.Reader and io.Writer go a long way, compared to the 20 io interfaces in java).
- cogman10 3y agoDang, If you didn't have the 2 requirement java could do it with this https://docs.oracle.com/en/java/javase/20/docs/api/jdk.httpserver/module-summary.html https://docs.oracle.com/en/java/javase/20/docs/api/jdk.https... I'll betcha 2 for the server comes soon.
- pjmlp 3y agoWe are now with Java 21 around the corner, and any Java EE server (nowadays Jakarta EE) framework supports HTTP/2, which is basically the Java standard library for servers.