Ask HN: What's Prolog like in 2024?

State of Prolog in 2024

  • Still actively developed and used, especially via SWI‑Prolog; other modern engines include Scryer and Trealla aiming at ISO conformance.
  • Very much a niche language: strong academic presence and some industrial pockets, but not a mainstream general‑purpose choice.
  • Some see Prolog as “dead” or obsolete, others say usage has been steady for decades in specialized domains.

Strengths and Appealing Ideas

  • Declarative “describe the problem, not the algorithm” style; same predicate can answer multiple related queries (e.g., parent/child/ancestor in one definition).
  • Built‑in search, unification and backtracking; particularly powerful with constraint logic programming (CLP(FD/Z)) for combinatorial and optimization problems.
  • Good fit for knowledge representation, ontologies, and reasoning over complex relationships; compared favorably to OOP for that.
  • DCGs and parsing: very concise, elegant parsing and state‑machine descriptions.
  • Logic code can often be reused in different “directions,” giving a relational feel that many find conceptually beautiful.

Limitations and Criticisms

  • Performance and robustness can be brittle; small changes in rule order or search strategy can drastically affect speed or termination.
  • Depth‑first backtracking makes certain infinite loops surprisingly easy to write; learners often struggle with unbound variables and search space explosion.
  • Lacks modern module/package ecosystem in many implementations; large codebases can become hard to manage, especially with extra‑logical features like “cut”.
  • Static typing is absent in classic Prolog; some argue this hurts robustness and maintainability.
  • Several commenters argue that for many industrial problems it’s better to use mainstream languages plus dedicated solvers (MIP, OR‑Tools, SMT, etc.).

Ecosystem and Related Technologies

  • Rich ecosystem around SWI (CLP libraries, Python and Java bridges, Janus, MQI).
  • Alternative or successor ideas: Mercury, miniKanren/core.logic, Answer Set Programming, Datalog systems (Soufflé, Logica, TypeDB, Cozo), CP solvers, and probabilistic programming.
  • Logtalk brings OO‑style structuring on top of Prolog; ErgoAI extends Prolog for advanced KR.
  • Logic/datalog‑style querying shows up in databases (Datomic, XTDB, DataScript, Cozo) and policy engines (Rego).

Use Cases and Adoption Patterns

  • Successful niches: configuration/CPQ systems, complex product configuration, scheduling and planning, expert systems, RDF/OWL reasoning, static analysis, constraint‑based search, some medical and industrial safety applications.
  • Often recommended today as:
    • A prototyping or modeling language before re‑implementation.
    • An embedded DSL or separate service for the “hard logic” part of a system, rather than the entire stack.
  • Widely valued pedagogically: learning Prolog (and CLP/Datalog) changes how people think about programming, even if they don’t use it daily.