from Hacker News

Mangle, a programming language for deductive database programming

by aarroyoc on 11/26/22, 9:14 PM with 46 comments

  • by triska on 11/26/22, 10:02 PM

    This seems already almost valid Prolog syntax, which is also a syntactic superset of Datalog.

    The main question I have for implementors of Datalog and Prolog variants like this: If you are that close to using Prolog syntax, why not go all the way and rely fully on Prolog, a language for which a well-defined ISO standard and several interesting implementations already exist. One of the key benefits you get in this way is Prolog's strength for meta-programming and reasoning about programs with the same formalism you use to state the specifications and queries. Abstract interpretation, query optimization etc. can be easily implemented in this way, instead of having to parse an additional formalism.

    It may be possible to implement such Prolog-"variants" entirely within Prolog by defining suitable infix or prefix operators, or adding conforming extensions in implementations. A conforming extension is one that does not conflict with existing ISO syntax. For example, something that would be a syntax error in conforming Prolog implementations could be used as an implementation-specific extension.

  • by burakemir on 11/27/22, 10:18 AM

    This is my project! So soon ... I was considering a Show HN but wanted to wait until things like documentation are a bit more complete, but here we are.

    Ask me anything.

  • by grose on 11/27/22, 10:23 AM

    Other resources for logic programming and Go:

    ichiban/prolog - ISO Prolog interpreter in pure Go, getting close to v1: https://github.com/ichiban/prolog

    trealla-prolog/go - ISO Prolog interpreter embedded via WASM: https://github.com/trealla-prolog/go

    guregu/pengine - library for interfacing with Pengines (SWI-Prolog's RPC protocol): https://github.com/guregu/pengine

    biscuit-auth/biscuit-go - Biscuits are a fancy auth token with a little Datalog engine: https://github.com/biscuit-auth/biscuit-go

    I'm a big fan of logic programming. We've been seeing a small resurgence of interest in it (for example Yarn using Prolog made some waves) and I have some optimism for its future.

  • by jitl on 11/26/22, 9:59 PM

    Interesting; Google engineer previously published Datalog variants for BigQuery: https://research.google/pubs/pub43462/ & https://logica.dev/

    This new language seems similar to differential-Datalog (which is sadly in maintenance mode): https://news.ycombinator.com/item?id=33521561

  • by linkdd on 11/26/22, 9:51 PM

    Inventing a language seems to be a rite of passage for every engineer at google.

    Go, Dart, Carbon, Mangle, am I missing some?

    I'm not criticizing, I would not dare as I'm creating my own language as well :P

  • by theodpHN on 11/26/22, 10:51 PM

    Some of the other stuff looks intriguing, but regarding the claim that "Unlike SQL, our Mangle rule projects_with_vulnerable_log4j has a name and can be referenced in other queries." goes, SQL in a VIEW or common table expression (CTE) can also be referenced in other queries.
  • by JimmyRuska on 11/27/22, 3:43 AM

    RDFox looks like the best bet for datalog databases, it computes changes incrementally, also with aggregation extensions. Logicblox, Soufflé, datomic, inter4ql, corese are also worth a look. Looks like there's a lot of innovation possible in the space, like distributed logic processing, incremental sorting, adding assert statements, figuring out why specific rules don't match recursively, etc
  • by UncleEntity on 11/26/22, 11:15 PM

    I’m probably wrong (I’ve been deep diving into RDF triplestores lately) but I think sparql does all that and has a W3C specification.

    Maybe the difference is you don’t have to convert your data into (subject, property, object) triples?

    Been reading this hexastore paper and they seem to be trying to solve the same problems but I’m no data scientist so who knows.

  • by sonicgear1 on 11/27/22, 10:24 AM

    Another useless and overly convoluted project just like all things google.