5 ms·
The README has "Use Rust for new features" in it, so I doubt it will retain the same simplicity. As much as I like Rust, and despite mixing Rust and C++ being
by ColonelPhantom 4y ago
The README has "Use Rust for new features" in it, so I doubt it will retain the same simplicity.
As much as I like Rust, and despite mixing Rust and C++ being the clear path forward for Mozilla, I'm not so sure it's the winning approach here. Part of the beauty of SQLite is the single .c/.h thing.
That said, I can see that maybe they're trying to expand the use cases of libsql compared to SQLite. That seems to be the whole idea with adding support for e.g. distributed databases, which is something SQLite just doesn't bother with at all, and would introduce a ton of external interfacing regarding networking. SQLite uses only the standard C library, and even then barely scratches its surface.
Also, SQLite's VFS API can do a lot there already. For example, I remember seeing SQLite compiled to WASM, using a VFS that downloads a remote database on S3 using HTTP Range requests. (I don't think it supported writing to the database, but it was still a really cool way of allowing complex client-side querying of a dataset that is static but too big to transfer).
- sgbeal 4y ago> Part of the beauty of SQLite is the single .c/.h thing. Noting that it's not _developed_ that way. Its many files are compounded together by the build process to produce the amalgamation build. In a mixed-language project (Rust for some, C for others) a single-file distribution literally won't be possible and it will require as many toolchains to build as there are languages involved.
- bpye 4y agoI wonder if mrustc [0] would be sufficient to retain the amalgamated build even if Rust were adopted. The regular Rust tool chain would be needed for development still, but if simply depending on the library the Rust components could be transpiled to C… [0] - https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc
- chasil 4y agoTH3 requires the components to be separate for testing. But that is not how it is meant to be used.
- ReactiveJelly 4y ago> a single-file distribution literally won't be possible Actually. You could compile the Rust into Wasm, then the Wasm into C. Firefox did this last year [1], so the tools exist and it's neither totally impossible nor totally stupid. The penalty is less than JITting or interpreting Wasm. wasm2c is the tool they apparently used in 2021. [2] [1] https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/ https://hacks.mozilla.org/2021/12/webassembly-and-back-again... [2] https://github.com/WebAssembly/wabt/tree/main/wasm2c https://github.com/WebAssembly/wabt/tree/main/wasm2c > wasm2c takes a WebAssembly module and produces an equivalent C source and header.
- sgbeal 4y ago> Also, SQLite's VFS API can do a lot there already. For example, I remember seeing SQLite compiled to WASM, using a VFS that downloads a remote database on S3 using HTTP Range requests. (I don't think it supported writing to the database, but it was still a really cool way of allowing complex client-side querying of a dataset that is static but too big to transfer). <https://github.com/phiresky/sql.js-httpvfs https://github.com/phiresky/sql.js-httpvfs>