
Ask HN: Datalog as the only language for web programming, logic and database - truth_seeker
Can Datalog be used as the only language which we can use for writing server-side web application, complex domain business logic and database querying?<p>Are there any efforts made in this direction.
======
alexmingoia
Not anything I’d want to use. The closest is prolog. But at a higher level
this is what Eve attempted to do.

Eve was built using the semantics of Dedalus which is built from datalog. I
_highly_ recommend watching Peter Alvaro’s Strangeloop talk about creating
Dedalus - it’s exactly the same train of thought you’re onto.
[https://youtu.be/R2Aa4PivG0g](https://youtu.be/R2Aa4PivG0g)

~~~
truth_seeker
Thanks :) Dedalus and Bloom language looks pretty neat.

[http://www.neilconway.org/docs/dedalus_dl2.pdf](http://www.neilconway.org/docs/dedalus_dl2.pdf)

I wonder why anyone hasn't put significant effort in it and make it
mainstream.

------
westurner
To quote myself from a post the other day
[https://news.ycombinator.com/item?id=19407170](https://news.ycombinator.com/item?id=19407170)
:

> _PyDatalog does Datalog (which is ~Prolog, but similar and very capable)
> logic programming with SQLAlchemy (and database indexes) and apparently
> NoSQL
> support.[https://sites.google.com/site/pydatalog/](https://sites.google.com/site/pydatalog/)
> _

>
> _Datalog:[https://en.wikipedia.org/wiki/Datalog](https://en.wikipedia.org/wiki/Datalog)
> _

> _... TBH, IDK about logic programming and bad facts. Resilience to incorrect
> and incredible information is - I suppose - a desirable feature of any
> learning system that reevaluates its learnings as additional and
> contradictory information makes its way into the datastores._

I'm not sure that Datalog is really necessary for most CRUD operations;
SQLAlchemy and the SQLAlchemy ORM are generally sufficient for standard
database querying CRUD.

------
nextos
I'm surprised nobody has mentioned Logicblox yet [1,2]

[1] [https://developer.logicblox.com/](https://developer.logicblox.com/)

[2] [https://www.cs.ox.ac.uk/dan.olteanu/papers/logicblox-
sigmod1...](https://www.cs.ox.ac.uk/dan.olteanu/papers/logicblox-sigmod15.pdf)

------
usgroup
Well, if that's what you want just use Prolog; everything you need is there
including a huge number of libraries and a web application framework.

Although I personally don't understand why anyone would want to do this ... If
you actually try using Prolog or Datalog, it becomes relatively obvious that
it makes a very specific set of things easier at the cost of making everything
else harder.

~~~
truth_seeker
I want to do this to have only One High level declarative language to cover
all areas to avoid impedance mismatch across all boundaries involved in full
stack programming so that learning curve can also get reduced.

Sticking to one language increases productivity as it encapsulates many
underlying lower level details which I must not be aware of to get productive.
In order to get more productive, I seek a language which is more about WHAT to
get done (declarative) than HOW to get done (imperative).

The parser, interpreter and JIT can hide away all the best practices which
otherwise needs careful crafty knowledge, lower-level optimization,
concurrency, data persistence and system level interfacing details.

I know to a certain extent it sounds like daydreaming but its awesome
abstraction to have. :)

I prefer Datalog over Prolog for a simple reason that Datalog is more
declarative and program termination is certain.

~~~
networked
Not what you asked for, nor is it ready to use, but Aquameta may be
interesting to you considering your high-level goal:
[https://github.com/aquametalabs/aquameta](https://github.com/aquametalabs/aquameta).

~~~
truth_seeker
Wow. Thanks for the link. I think might be okay with SQL instead of Datalog.
Besides that I love Postgres.

------
slifin
Fulcro, Pathom, EQL and Datomic

Is full stack datalog as far as I'm aware

Not tried any of them yet but actively trying these are some tough things to
learn

~~~
slifin
Oh I should mention [http://www.hyperfiddle.net](http://www.hyperfiddle.net)
is a realisation of this kind of stack

~~~
dustingetz
Thanks for the mention - Yes, "datalog" for "everything" is the core
hypothesis we are testing with Hyperfiddle.

"Datalog" we've interpreted as Datomic Query and Transaction DSL, which is
basically exactly what you need for automatic tables and forms – both read
side and write – and not an inch more or less.

Very small amounts of Clojure are necessary to glue it all together. React.js
view layer progressive enhancement is completely optional, so that doesn't
count. There is a small data model for routing (hyperlinks, like the web) and
Clojure's namespaced keywords turn out to be very important as well.

Maturity – today, we think Hyperfiddle is amazing at administration
dashboards, you can crank them out really fast – basically about as fast as
you can think.

