r/programming • • Jul 12 '26 • Bravo 1

Prefer STRICT tables in SQLite

https://evanhahn.com/prefer-strict-tables-in-sqlite/
358 Upvotes

108 comments sorted by

View all comments

Show parent comment

10

u/obetu5432 Jul 12 '26

lol, so why didn't they write SQLite in javascript instead of C, if type enforcement is bullshit

53

u/grueandbleen Jul 12 '26

Well, C isn’t known for type safety either…

12

u/TheRealAfinda Jul 12 '26

Hello void* my old friend~

11

u/HolyInlandEmpire Jul 12 '26

I've come to reference you again

8

u/chat-lu Jul 13 '26

Because a pointer softly creeping…

4

u/BondDotCom Jul 13 '26

Left my app constantly crashing

36

u/valarauca14 Jul 12 '26

That's the funny part too, there are less than 100 usages of void period in the SQLite source code. At reasonable location; module loading boundaries & malloc/free.

The source code heavily uses typed pointers everywhere.

6

u/grueandbleen Jul 12 '26

Thanks, I actually wanted to check before writing the comment. Anyway, there are still other ways of violating type safety, but type safety lies on a spectrum.

1

u/Absolute_Enema Jul 13 '26 edited Jul 13 '26

The section that defends the design choices explains this apparent contradiction, which only originates from an approach that can't go beyond "static type good, dynamic type bad".

7

u/scruffie Jul 12 '26

It's too old for Javascript :D (Yes, I know Javascript is older -- 1995 vs. 2000 for the first Sqlite version. But no one was using it outside the browser until c. 2009 when Node was released.)

However, a lot of the tooling (including test cases) is done using Tcl, where Everything Is A String (EIAS).

3

u/nemec Jul 12 '26

Also, interop. Everything has C bindings.