News for hackers. Stuff that matters.
Re:Zig now has built-in HTTP server and client in std by lmm on Thursday May 18, 2023 @11:12PM (#35997293)
> I wish more programming languages provided interfaces for building libraries around the std library like what Go does. It makes using libraries a lot better because you aren't dependent on that library as long as it uses the std library interface.

> This is huge for things like database drivers which might become outdated or not support certain features. In Go switching database drivers in as simple as importing the new library. You dont have to change your code.

The effect is that every database driver becomes outdated and doesn't support certain features, instead of just a few. Python people have a saying that the standard library is where modules go to die. Java's database drivers massively lag behind (e.g. there's still no good async support for most of them), because JDBC is a lowest common denominator that every driver has to be dumbed down to, but is established enough that it sucks all the oxygen away from any efforts to write better drivers.

Far better to keep the standard library small and allow modules to update on their own terms and their own schedule. If the library you're using does what you need, you can stick with it, but a better alternative (which always means a new interface in practice - the idea that you can make substantial improvement without changing the interface is mostly a myth, because the interface is the most important part of a library) can appear and compete on its merits, and if the improvements are worth migrating to then it will win out.

Re:Zig now has built-in HTTP server and client in std by alfiedotwtf on Thursday May 18, 2023 @11:22PM (#35997349)
Exactly. Perl had BerkleyDB as part of Core, as well as CGI. How's that going for the Perl footprint!
Re:Zig now has built-in HTTP server and client in std by born-jre on Thursday May 18, 2023 @11:45PM (#35997505)
one approcach with golang is make interface that can be leaked if you really want, you will be using standard interface 99% but if you need sth not provided by abstraction you can ask for underlying impl `db.Driver()` and cast to appropriate type.
Re:Zig now has built-in HTTP server and client in std by lenkite on Friday May 19, 2023 @12:27AM (#35997740)
> Java's database drivers massively lag behind (e.g. there's still no good async support for most of them),

Very Hard Disagree. JDBC is pretty amazing actually. Thats why you find so many Database tools and wizards written in Java as opposed to Rust.

Regarding async - With Java 19 virtual threads , you have newer versions of JDBC drivers support async with none to minimal changes. Example: https://medium.com/oracledevs/introduction-to-oracle-jdbc-21...

I am very, very glad that human civilisation standardised on one system for gears instead of every manufacturer making their own special snowflake.

Re:Zig now has built-in HTTP server and client in std by lmm on Friday May 19, 2023 @12:48AM (#35997875)
> Very Hard Disagree. JDBC is pretty amazing actually. Thats why you find so many Database tools and wizards written in Java as opposed to Rust.

Java is much older and bigger than Rust. I don't think its level of database tooling is noticeably better than other big languages with less of a standard database API (e.g. Python).

> Regarding async - With Java 19 virtual threads , you have newer versions of JDBC drivers support async with none to minimal changes.

So it's only taken what, 15 years, and even then it's only been done because they found a way to make it happen without having to actually change the API (which it remains to be seen how well that actually works in practice - I'm pretty skeptical because other platforms have tried and failed with that approach).

Re:Zig now has built-in HTTP server and client in std by dragonwriter on Friday May 19, 2023 @02:56AM (#35998640)
> I don't think its level of database tooling is noticeably better than other big languages with less of a standard database API (e.g., Python)

DB-API 2.0 (PEP 249) is very much a standard database API.

Re:Zig now has built-in HTTP server and client in std by badrequest on Friday May 19, 2023 @12:44AM (#35997854)
Go doesn't provide standard library implementations of database drivers, only standard library interfaces for driver implementations to adhere to.
Re:Zig now has built-in HTTP server and client in std by lmm on Friday May 19, 2023 @12:52AM (#35997906)
I addressed this in my last paragraph.
Re:Zig now has built-in HTTP server and client in std by JodieBenitez on Friday May 19, 2023 @01:29AM (#35998126)
> Python people have a saying that the standard library is where modules go to die.

That's just a quote from a 10 years old talk by Kenneth Reitz, and it's quite an overstatement.

Re:Zig now has built-in HTTP server and client in std by jiehong on Friday May 19, 2023 @01:44AM (#35998209)
Java has something called R2DBC as well, the async jdbc driver equivalent. Most major db have such a driver nowadays.
Re:Zig now has built-in HTTP server and client in std by lmm on Friday May 19, 2023 @01:55AM (#35998291)
Right, but it's very hard to overcome the inertia of an established standard.

(JDBC isn't actually in the standard library IIRC but it's a JSR, so it's an "official" part of the platform and that creates a lot of pressure to follow that)

Re:Zig now has built-in HTTP server and client in std by pjmlp on Friday May 19, 2023 @02:23AM (#35998451)
All those complains always forget that the standard library happens to be available everywhere the language has a full implementation available, while third party libraries are hit and miss.

I rather have outdated code that works, than not having anything at all.

Re:Zig now has built-in HTTP server and client in std by lmm on Friday May 19, 2023 @02:48AM (#35998591)
> All those complains always forget that the standard library happens to be available everywhere the language has a full implementation available, while third party libraries are hit and miss.

Only if your dependency management is bad.

And if you're stuck running on e.g. an old install of the language, there's at least a chance that the third party library will support it, whereas if you want a new standard library feature you're SOL.

Re:Zig now has built-in HTTP server and client in std by pjmlp on Friday May 19, 2023 @03:01AM (#35998670)
All dependency managements are bad when they assume UNIX only workloads with C compilers pre-installed.

And on top of that download half of the Internet for doing an hello world with error handling or asynchronous code.

Re:Zig now has built-in HTTP server and client in std by JodieBenitez on Friday May 19, 2023 @04:16AM (#35999191)
> Only if your dependency management is bad.

Please give an example of good dependency management in any language. It seems to be one of these subjects draining constant displeasure.

I'm not advocating against third party libraries, I just think a reasonably rich standard library sets a good foundation for them.

Re:Zig now has built-in HTTP server and client in std by lmm on Friday May 19, 2023 @07:00AM (#36000117)
Maven has worked well for over a decade. I understand cargo is similar.

If your dependency management is any good then there's nothing to lose and a lot to gain from splitting your libraries out and allowing them to have independent release cycles. You can always do "platform" releases that aggregate together a bunch of finer-grained libraries with versions that are known together if you have a use case for that; going the other direction is a lot harder.

Re:Zig now has built-in HTTP server and client in std by pjmlp on Friday May 19, 2023 @11:13AM (#36002924)
As long as it is pure Java code.
Re:Zig now has built-in HTTP server and client in std by JodieBenitez on Sunday May 21, 2023 @05:27AM (#36019221)
Did maven help to split out Java's standard library ? Is Java's standard library small ?
Re:Zig now has built-in HTTP server and client in std by lmm on Sunday May 21, 2023 @05:37PM (#36024909)
> Did maven help to split out Java's standard library ?

I would say so, although splitting an existing standard library is still extremely painful and cumbersome thing to do (I don't think any other major language has seriously attempted it) - exactly why it's better to avoid having a large standard library to start with.

> Is Java's standard library small ?

I'd say no, but the parts of it that are used nowadays are. For example there is an HTTP client implementation in the standard library, but it's very rarely used by today's Java programs since its design is quite dated.