r/programming • u/wheatBread • 14d ago
"What if SQL was like Elm?"
https://acadia.engineering/blog/rethinking-database-programming34
u/yarovoy 14d ago
I wonder what do they mean by "Verified Migrations".
Because just knowing types is not enough to avoid "body goes on high alert". If you missed that operation is blocking on a table of 10 records, it's fine. But if you missed blocking operation on a table of a some billion records, here down goes you system.
26
u/nnomae 14d ago
I've used so many database libraries, ORM layers even stuff like Linq, Elixir's Ecto and many many others. I have to admit though, that after all that nothing is as easy to use, as flexible and as powerful as Rust's SQLx which basically just lets you write raw SQL without it being a massive pain in the ass.
86
u/andynzor 14d ago
Someone reinvented LINQ for their favorite programming language?
76
u/jking13 14d ago
Once you've been developing for > 10 years, you'll see people rediscover and reinvent everything under the sun.
56
u/solve-for-x 14d ago
My favourites so far have been AWS Lambda reinventing CGI and Next.js reinventing PHP.
29
u/jking13 14d ago
Or protobufs are basically ASN.1 with C-like notation and slightly better serialization rules, but less expressive.
23
u/solve-for-x 14d ago
The post the other day about Cloudflare's "durable objects" thing made me wonder if someone over there is inadvertently reinventing Erlang. Either that or Python's Zope. Every programming technology from the 90s eventually comes back around again under a different name.
13
10
u/atxgossiphound 14d ago
Every programming technology from the 90s eventually comes back around again under a different name.
I always just point people to the wizard book (SICP, Structure and Interpretation of Computer Programs, Ableson and Sussman). Combined with the standard problem sets, pretty much everything you'll ever re-invent is covered.
5
u/PayOdd92 14d ago
Unfortunately nobody got promoted for saying "oh this? There's a library for this"
3
2
14
u/Cheeze_It 14d ago
Sometimes what was made in the past is pretty shitty, and someone making a new one is the right thing. Not always. But sometimes.
5
u/davidalayachew 14d ago
Or it was lipstick on a pig. A good thing on an otherwise pretty bad or terribly outdated tool.
13
u/iiiinthecomputer 14d ago
LINQ in turn is to a degree a reinvention from 4GLs like Progress, Plain English etc
11
u/sequentious 14d ago
I mean, I've been doing a fair amount of development in older languages that make some LINQ features look like a reinvention.
7
u/TheGoodBarn 13d ago
the guy who created the language* reinventing LINQ for his favorite programming language
3
u/pjmlp 14d ago
Actually LINQ itself was a re-invention as well, see Confessions of a used programming language salesman from Erik Meijer of Haskell fame, at the time at Microsoft on the .NET team.
10
u/evincarofautumn 14d ago
How does this differ from something like Beam? Like, I already have strong types and verified migrations, although there are still some cases where I can’t use Beam’s migration facilities. I guess Acadia is meant to give better DX and interop across languages?
12
u/chubs66 14d ago
SQL is perfect. Leave it alone.
14
4
6
5
2
u/agentoutlier 14d ago
I wonder if it is really worthy having leaky abstractions like this or an ORM on top. All these things do is ultimately generate SQL.
This just seems cooler than an ORM because well its Elm and functional programming.
And I would not be that critical if this was like 2 years ago but "SQL <-> to your language types" w/o abstractions is done really well with LLMs. You can hate LLMs but is mapping database data to programming languages types really worth the time of a human even if its automated by a library because then the human has to learn about that library instead of just SQL.
If I did use any of these kind of things I would rather these guys generate SQL at compile time (parameterized or template like or ... god forbid ... the maligned stored procedures).
1
u/pdoherty926 14d ago
This looks compelling and is a really clever answer to the "does Elm run on the server?" question. (FWIW, I still think that's a perfectly reasonable desire and Gren did a great job with their implementation of server-side "Elm".)
The devil is sure to be in the details, though, and I'm curious to see how auth, row-based access and the like will work in practice.
-1
14d ago
[deleted]
9
u/curien 14d ago
SQL has been Turing complete since SQL99.
12
u/bluegardener 14d ago
And the point of this article and language wasn't even about turning it into "real" programming language. It was about precise type conversions, verification, and error messages.
123
u/syklemil 14d ago
Oh, it's the actual Elm guy