
Ask HN: Why isn't logic programming more popular? - cadencemcshane
It seems like such a powerful paradigm, but it doesn't get nearly the press these days that OO and functional programming have. What could be the reason for this?<p>I wonder if we're due for a young language to rejuvenate Prolog the way Clojure has done for Lisp.
======
_delirium
Here are a few recent takes on it, focusing mostly on the rise and fall of
Prolog:

* <http://vanemden.wordpress.com/2010/08/21/who-killed-prolog/> \- Discusses how closely Prolog became tied to the rise and fall of the Japanese Fifth-Generation Computer Systems project

* <http://vanemden.wordpress.com/2010/08/31/the-fatal-choice/> \- Argues that Prolog was wrong-footed by the increased focus in industry on data structures and interfaces, rather than program logic. Prolog proposes a better way of doing program logic, but has little to say about data structures or encapsulation. (The article proposes how that might be fixed, too.)

* <http://synthese.wordpress.com/2010/08/21/prologs-death/> \- Argues that the difficulty of debugging and reasoning about Prolog execution, and its slow execution (especially in the early days), are bigger factors than many Prolog advocates admit.

* <http://www.kmjn.org/notes/prolog_lost_steam.html> \- Argues that Prolog's low-hanging fruit got poached. In the 1970s it was the only real declarative-programming game in town, but over the next few decades a bunch of more specialized declarative languages succeeded in various niches, reducing Prolog's uniqueness and appeal.

------
ronnieCA
While logical programming is powerful, it is only useful in certain
situations. Due to the way Prolog backtracks to find a final solution, it can
be increadibly slow, and it has to be able to 'undo' an operation.

While it is a much different language now, Erlang was originally based on
Prolog, and has been adopted, modified and extended to be a much better
"realworld" language.

~~~
rndmcnlly0
It's not that Prolog necessarily backtracks to find the final solution. It's
the forward computation that actually builds the solution, backtracking only
when one can't be found with assumptions made so far.

Sloppy programming can lead to lots of unnecessary backtracking, of course,
but some of the main benefits of Prolog come in using it for problems where
you would have otherwise written your own ad-hoc backtracking search process
to find a solution. That is, good Prolog code only likely to be slow because
of it's backtracking when an imperative solution would have been
slower/buggier.

Runtime slowness because Prolog is a dynamically-typed language that also
strongly encourages the development of meta-intepreters as a common tactic is
a separate issue. Often times a slower run time is acceptable in exchange for
a much faster development time with the use of custom metalanguages (DSLs).

Integrated search aside, another benefit of logic programming comes in
declarative knowledge representation. In an expression optimizer I wrote, it
was easy to concisely define several code substitution patterns as simple
logical statements and then create the overall optimizer as an interpreter
over those declared patterns.

For problems that don't really revolve around search or knowledge
representation (i.e. most CRUD web stuff), Prolog doesn't provide practical
benefits. Nonetheless, understanding the otherwise foreign concepts of the
language can give you the seeds of new design patterns and idioms for your
familiar languages.

------
frobozz
yes.

