4 ms·
Looks very nice. Last year I took up rust, coming from c++, and some of the modern features rust brings are just so nice to have (even something as simple as no
by raumgeist 2mo ago
Looks very nice.
Last year I took up rust, coming from c++, and some of the modern features rust brings are just so nice to have (even something as simple as not having to forward declare a class).
This year I started working with postgres and you just can't help but notice how sql is coming from the c-Era of programming. Having better and more modern ways to express my queries would be great to improve correctness and performance.
- schaefer 2mo ago> …can't help but notice how sql is coming from the c-Era of programming. Having … more modern ways to express my queries would be great to improve correctness … SQL is based in pure mathematics: set theory, relational algebra. The process of applying mathematical rigor to your database design to prove correctness is referred to as normalization. I don’t mind criticisms like “It’s old, yuck”, but criticisms like “it’s not correct” mean you haven’t studied or applied the mathematical underpinnings of sql.
- mkehrt 2mo agoThis isn’t talking about correctness of SQL. It’s talking about correctness of queries.
- dminik 2mo agoSyntax aside, programmers and mathematicians have a very different view on how things should be done. Programmers look at data and see opportunities for running a pipeline of transformations (map/filter/...). And they tend to write their SQL like this as well. Or use something like Linq or one of the various pipe syntax SQL extensions. I would say that this is a major reason why there is this sentiment of "SQL is yucky" by developers. The mental models just don't match.
- skydhash 2mo agoData storage and retrieval is a different domain than data processing. SQL is very good at the former, not so great for the latter. SQL is closer to array programming than the usual imperative implementation of looping (and stream programming like the one in Java and Javascript). A better implementation is functional programming like haskell and clojure (lazy and composition of functions). I think developers should be able to switch their mental model on the fly according to the current domain instead of getting stuck in the first paradigm they have learned.
- pjmlp 2mo agoOr they did a proper Software Engineer degree that teached on how to use SQL properly, including implementing their own toy SQL engine backed by B-Tree indexes, with raw i-node blocks for storage.
- huahaiy 2mo agoIt is older than C. It is based on COBOL era idea of structured English as a computer language. There are better alternatives, e.g. Datalog.
- senderista 2mo agoCOBOL is indeed the spiritual predecessor of SQL. We have learned a lot since then about PL design, to put it mildly.
- pjmlp 2mo agoYes, we now programm in straight English, and hope the machine gets it right.
- huahaiy 1mo agoSo this really is a NL to query translation problem. That exactly is why the target language matters. Simpler target languages makes AI’s work easier, as it saves tokens and context, so it is less likely for AI to make mistakes.
- pjmlp 2mo agoThese kind of comments don't age well in the days of AI programming using English.
- huahaiy 1mo agoAI programming using English makes the database query language choice more important than before. Different languages require different context sizes. A better language is one requires less tokens and context.
- schaefer 2mo agoI'm curious if you've personally used datalog in any projects. I've written some prolog, but haven't ever worked with datalog. Minigraph looks promising for some introductory goofing around.