News for hackers. Stuff that matters.
Re:How I Built Zig-SQLite by apavlo on Friday May 27, 2022 @11:29AM (#31530746)
> couldn't a Zig reimplementation of SQLite use comptime for compile-time query compilation? Including generating native code for fixed queries?

SQLite already compiles queries into opcodes and then uses its own VM to interpret them. You would have to reimplement the internal VM.

Re:How I Built Zig-SQLite by jhgb on Friday May 27, 2022 @11:43AM (#31530926)
I'm aware of that, but these elementary operations have some definitions in code. Even just calling them in a fixed sequence (as opposed to dispatching at runtime one opcode at a time) would be something optimizable for a sufficiently smart compiler. However, given a good-enough design of the whole system, straight code generation from the query plan shouldn't be a problem either (and at that point, the Zig compiler should be able to do even more work with the generated query code). I mean, any reimplementation would presumably use Zig features heavily anyway -- otherwise you could just link with the C code.