5 ms·
Datafrog: A lightweight Datalog engine in Rust
- chrismorgan 4y ago> Datafrog was initially developed by Frank McSherry and was later transferred to the rust-lang-nursery organization. Is its present membership in rust-lang rather than rust-lang-nursery a mistake? (I find its membership even in rust-lang-nursery mildly surprising; in rust-lang, perplexing.)
- idmitrievsky 4y agoIt looks like an official borrow checker implementation called Polonius uses it as a dependency, so it makes sense: https://github.com/rust-lang/polonius/blob/981785c101b68ff54663f34557ad85d5e9478dc7/polonius-engine/Cargo.toml https://github.com/rust-lang/polonius/blob/981785c101b68ff54...
- kibwen 4y agoNote that while Polonius is officially developed by the Rust project, it's still experimental. The goal is to someday ship it as part of rustc, but it still needs work.
- Tarean 4y agoBorrow checking is a good fit for datalog. And trait resolution is Prolog, though Rusty's backtracking makes it a worse fit for datalog than typeclasses in Haskell.
- mywaifuismeta 4y agoWhat would be the practical use cases of using something like this as a library in your application?
- minxomat 4y agoIn modern contexts (outside of compilers): policy evaluation, see e.g. OPA's ReGo which uses Datalog enhanced with structured data support.
- nerdponx 4y agoWould you want to use a Prolog/Datalog for things like authorizing users in a RBAC system? I give the engine a bunch of rules and properties of things, and the engine figures out whether or not the user is authorized to perform some specific action.
- minxomat 4y agoThat's exactly what OPA does.
- jasonwatkinspdx 4y agoYou ever run into a situation with SQL where you're trying to do something that's sorta tree shaped, and it makes the code awkward even if you use say vendor extensions for recursive queries? Datalog excels at those sort of problems.
- mywaifuismeta 4y agoBut I still need to send a SQL query to the database. How does a Datalog engine in Rust help me?
- jasonwatkinspdx 4y agoYou put your data in the library to get your answer.
- adenozine 4y agoOh, well you’ll get to post something to HN that’s “written in Rust”, isn’t that enough? /s
- zozbot234 4y agoYou can do recursive queries in SQL via standard CTE's, no vendor extensions needed whatsoever.
- sinistersnare 4y agoI think people should look at Ascent [1]. I love the way it embeds Rust seamlessly. It's like JSX for Datalog/Rust. [1]: https://github.com/s-arash/ascent https://github.com/s-arash/ascent
- sixwing 4y agoAscent is lovely. The paper on it is really well written, too: https://s-arash.github.io/ascent/cc22main-p95-seamless-deductive-inference-via-macros.pdf https://s-arash.github.io/ascent/cc22main-p95-seamless-deduc...