Live data from Hacker News

Mangle, a programming language for deductive database programming

github.com

1–10 of 48 posts

Re: Mangle, a programming language for deductive database programming

#3
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

Re: Mangle, a programming language for deductive database programming

#4
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.

Re: Mangle, a programming language for deductive database programming

#5
post #2

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

those are just the public ones

Re: Mangle, a programming language for deductive database programming

#6
post #2

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

Yes - my only attempt was in the early 1980s when I started to develop a language implemented on top of interpreted BASIC. It was called MAL (My Attempt at a Language). I wish I still had it - I have no recollection what my design goals were, if any! The only thing I have left is the name, and I'm quite sure that was the best part about it anyway.

Re: Mangle, a programming language for deductive database programming

#7
post #2

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

4 languages doesn't really seem that many given how many engineers there are at google...

Re: Mangle, a programming language for deductive database programming

#8
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.

Re: Mangle, a programming language for deductive database programming

#9
post #4

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…

Because syntactic doesn’t mean semantic subset. Datalog uses bottom-up evaluation by default while Prolog uses top-down. As such they are computationally very different.

Re: Mangle, a programming language for deductive database programming

#10
post #9
post #4

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…

Because syntactic doesn’t mean semantic subset. Datalog uses bottom-up evaluation by default while Prolog uses top-down. As such they are computationally very different.

Yes well, as you mention, that is only the default execution strategy, and nothing prevents us from using other execution strategies for either language. In fact, the main advantage of using a declarative language such as Prolog or Datalog is precisely that it can be readily interpreted with different execution strategies, and indeed many Prolog implementations already provide alternative execution strategies, the most common of which is currently SLG resolution, also known as tabling. Alternative execution strategies are applicable as long as you keep to the pure monotonic core of the language.

The fact that the default execution strategies of Prolog and Datalog differ is not a valid argument for or against using a slightly different syntactic formalism. If, as seems plausible, an alternative execution strategy of Prolog can provide the same semantics as Mangle and other Datalog "variants", then it may be worth considering doing that instead of devising a different syntactic formalism, especially if the alternative syntactic formalism is already so close to valid Prolog syntax as it is in this concrete case.

Post reply on HN