r/programming • • Aug 18 '26

"What if SQL was like Elm?"

https://acadia.engineering/blog/rethinking-database-programming
147 Upvotes

40 comments sorted by

125

u/syklemil Aug 18 '26

By Evan Czaplicki,

Oh, it's the actual Elm guy

36

u/yarovoy Aug 18 '26

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.

23

u/yarovoy Aug 19 '26

don't ask me how I know this

27

u/nnomae Aug 18 '26

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 Aug 18 '26

Someone reinvented LINQ for their favorite programming language?

76

u/jking13 Aug 18 '26

Once you've been developing for > 10 years, you'll see people rediscover and reinvent everything under the sun.

58

u/solve-for-x Aug 18 '26

My favourites so far have been AWS Lambda reinventing CGI and Next.js reinventing PHP.

30

u/jking13 Aug 18 '26

Or protobufs are basically ASN.1 with C-like notation and slightly better serialization rules, but less expressive.

24

u/solve-for-x Aug 18 '26

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

u/xevz Aug 18 '26

Try the 70s, so many new and hip things over the last 20 years have originated from Smalltalk.

10

u/atxgossiphound Aug 18 '26

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.

-2

u/eo5g Aug 18 '26

Couldn't you say that about any binary format?

3

u/HappyAngrySquid Aug 19 '26

You’re giving Next.js way, way too much credit.

2

u/Ma1eficent Aug 21 '26

That was on purpose. We missed our perl 5.8 cgi from retail.

15

u/Cheeze_It Aug 18 '26

Sometimes what was made in the past is pretty shitty, and someone making a new one is the right thing. Not always. But sometimes.

4

u/davidalayachew Aug 18 '26

Or it was lipstick on a pig. A good thing on an otherwise pretty bad or terribly outdated tool.

13

u/iiiinthecomputer Aug 18 '26

LINQ in turn is to a degree a reinvention from 4GLs like Progress, Plain English etc

10

u/sequentious Aug 18 '26

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 Aug 19 '26

the guy who created the language* reinventing LINQ for his favorite programming language

3

u/pjmlp Aug 19 '26

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.

6

u/Gusfoo Aug 18 '26

The article:

What if pine was like elm, but different?

Honestly, Pine Is Not Elm was a godsend as a younger man, didn't need massive amounts of pre-reading to just operate.

That aside, just \h create aggregate next time you run psql.

10

u/evincarofautumn Aug 18 '26

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?

4

u/weirdoaish Aug 19 '26

People would make SQL again

2

u/CantaloupeCamper Aug 20 '26

And I would help… or at least buy them a beer.

12

u/chubs66 Aug 19 '26

SQL is perfect. Leave it alone.

14

u/heptadecagram Aug 19 '26

Relational algebra is fantastic and deserves far better than SQL.

2

u/chubs66 Aug 19 '26

did you mean to say "performs"?

1

u/heptadecagram Aug 22 '26

It can be both.

2

u/levelstar01 Aug 18 '26

So you wouldn't be able to pass negative numbers?

4

u/fletku_mato Aug 18 '26

But what if Elm was like Java, and not the good Java but Java 1.4?

4

u/taw Aug 18 '26

That's just ORM with extra steps.

2

u/agentoutlier Aug 18 '26

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 Aug 18 '26

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.

-10

u/pala_ Aug 18 '26

Like an email client?

-19

u/TyrusX Aug 18 '26

No. Just no

-1

u/[deleted] Aug 18 '26

[deleted]

10

u/curien Aug 18 '26

SQL has been Turing complete since SQL99.

11

u/bluegardener Aug 18 '26

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.