r/programming • u/eejdoowad • 11d ago
SakaQL: A new general-purpose relational programming language
https://www.saka.io/blog/sakaql-general-purpose-relational-programming-language/SakaQL explores this idea: can you build a relational programming language that's usable outside of databases and actually nice?
Cool ideas include native incremental view maintenance based on DBSP, set-based types inspired by TypeScript and EdgeQL, a composable regular expression alternative, native parsing inspired by Janet and Raku, and unbounded integers with interval subtypes, and innovative syntax design.
39
Upvotes
32
u/lood9phee2Ri 11d ago
Yeah, SQL was designed to be "english like". You know, like Cobol. So "friendly" that business end-users could just write it instead of those expensive programmers.
The relational model is fundamentally quite pretty with unusually strong grounding in actual mathematical/logical theory. Just obscured horribly by SQL concrete syntax. BUT the fact there's some sort of an actual cross-vendor language standard is good too....
https://en.wikipedia.org/wiki/Relational_calculus
13
u/chat-lu 11d ago
I don't get it, aren't you offering that same trade-off?
6
u/ginrumryeale 11d ago
Looks interesting, however once you cross the boundaries of the CRUD operations SQL was designed for it stops looking like simple, highly readable SQL.
It looks like somone’s fairly ordinary scripting language project influenced by a query language.
24
u/josephjnk 11d ago
SQL is good, actually. Not even a hot take to say so.
Maybe SakaQL is good too, though in 2026 my default assumption is that everything new is vibecoded. I’m not really interested to put in the work to dig for what’s worthwhile here when the author spends half of the article trying to dunk on SQL. If someone can’t understand what’s good about SQL then I don’t trust them to try to make something better.
1
u/Wonderful-Wind-5736 10d ago
Mmm, nice language. I'd much rather write that than SQL. Although I'm not sold on the scripting language side. Generally a good scripting language needs great interop to earn its place, and I'd rather see your unique features be implemented as a Python DSL. That said if you could actually target SQL, or even better Substrait, that would be pretty hot.
1
u/manifoldjava 10d ago
Interesting. A bit low-level though for general-purpose: no abstractions to combine behavior and data/records. At least I didn't see that in my scan of your docs.
My ideal general-purpose language for relational models would be interface composition via *true* delegation (ordinary object composition + open recursion). Closest to this is probably traits (Scala), unfortunately traits are not object composition, they are linearized into the inheritance model forcing a single object identity and all its limitations.
1
u/danielaveryj 7d ago
Hey, just wanted to give some feedback, I saw this post when it came out and have poked around here and there the last few days. I'm looking at this as someone who has now spent considerable time designing their own relational language (for querying / UI, not general scripting), so I'm probably more comfortable thinking in that paradigm than others would be (but I'm sure I have my own hang-ups).
I first want to say this looks brilliant in several ways. I think I'd heard the idea before of modeling cardinality as an axis in the type system, but it felt eye-opening for me seeing the regex quantifiers combined with a component type and a universal bag data structure - so basically, every value uniformly supports querying, while still allowing us to enforce exactly-one / maybe-one / at-least-one of a specific type. I think that's an evolution over EdgeQL's sets, and at least two evolutions over Lua's tables.
It's very cool to hear that you incorporated IVM into the language. Integrated into a general-purpose language, it seems like that would dramatically improve the feasibility of scripting responsive data-intensive interactive apps.
Also, to have all this actually working and running in the browser is incredible.
I do want to talk about your docs, because I feel like they're not selling this as well as they could.
On the introductory page, I felt pulled in initially and was reading intently, but as it went on I ran into more and more hiccups that pushed me to skim. I think the first one was here:
On a first read, I'm inclined to assume this desugars to two pointwise concatenations: First joining "hi " to {"mo", "jo"}, and then joining that bag to the empty string (that follows the interpolated bag). But up until this point I haven't seen *any* string concatenation or interpolation in this language, so I'm not sure if what I'm looking at really is an "interpolated bag" or means something more context-specific entirely. The actual behavior (which I eventually discovered in the REPL) would be clearer if a non-empty string followed, and clearer still if an example had multiple interpolations, but I'm not given an answer at this point, and now I'm distracted from the simple idea of this section ("Arithmetic expressions are pointwise").
Similarly in the "Recursion" section, three new operators are introduced on one line - yes, I can guess what the result is supposed to be, but I can't decipher how we're getting there. And again in "Native parsing" - I see new keywords, something that looks like a tuple but with a hash symbol before it, something that looks like a bag but with a minus sign before it, something that looks like a reference but with a colon before it, and so on. I know you're trying to show a lot (maybe that doesn't all need to be shown up-front?), but leaving so many unexplained sigils in introductory material gives a feeling that the language has sharp corners.
Of course, I was still drawn in, so I read most of the SakaQL tutorial and reference. This was good, and a lot better at introducing new things gently / carefully, but I really wish examples (or at least individual pages) were more self-contained - assuming a persistent REPL context the whole time makes it increasingly difficult to recall what we're operating on, especially when using these pages as a reference later.
As a side note, I much preferred the syntax that puts the cardinality by the type, rather than the variable name. I spent forever just looking for the syntax to combine a Set + "allowlist" + arbitrary cardinality - I think this is the closest the documentation comes to showing the full-generality syntax.
My overall impression is that this is a really interesting language and an impressive project, and I would like to live in a world where this takes off, but that's hard for me to picture right now. I think part of it is that the commercial pitch - which seems aimed more at data management tools than scripting - feels uncomfortably similar to EdgeQL, and susceptible to the same "boiling-the-ocean" concerns. It wouldn't help that the language is perhaps more complex than theirs, in a domain that overlaps less-technical users, and at a time when even developers' appetites for language innovation are perhaps greatly depressed. On the other hand, you've seemed to emphasize the scripting aspect here, and I do think the language brings something new and exciting to that arena (I would personally love to see more people casually wielding an IVM-backed relational toolkit).
1
u/GarageFullStack 1d ago
The bag semantics with unbounded integers and interval subtypes are interesting, but I'm skeptical about the performance overhead of native incremental view maintenance at scale without a dedicated storage engine. DBSP is cool in theory for changelog propagation, yet implementing it in a general-purpose language often means paying that cost in memory churn. You get nice syntax for parsing and types, sure, but you still have to wrestle with the underlying data structures when the dataset grows beyond what fits in RAM.
I looked at similar approaches where people try to keep everything in plain text files or git repos for portability. It works fine for micro-caps projects or small datasets where I can afford the latency, but it falls apart when you need real-time joins on millions of rows. The language design is solid for the garage dev workflow, but don't expect it to outperform a compiled Go service hitting an optimized index.
3
u/MeMahi 11d ago
Interesting.
1
u/Ayano-Keiko 10d ago
LINQ?
-14
u/commenterzero 11d ago
Gross
-13
u/cheesekun 11d ago
This is not the problem to be solving right now in computer science. Whats the expression "tone deaf".