Hacker News new | ask | show | jobs
by mywaifuismeta 1320 days ago
What would be the practical use cases of using something like this as a library in your application?
2 comments

You 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.
You can do recursive queries in SQL via standard CTE's, no vendor extensions needed whatsoever.
But I still need to send a SQL query to the database. How does a Datalog engine in Rust help me?
You put your data in the library to get your answer.
Oh, well you’ll get to post something to HN that’s “written in Rust”, isn’t that enough?

/s

In modern contexts (outside of compilers): policy evaluation, see e.g. OPA's ReGo which uses Datalog enhanced with structured data support.
Would 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.
That's exactly what OPA does.