Following some prolog tutorials, it looks like the...
# of-logic-programming
e
Following some prolog tutorials, it looks like the data/terms always has sort of a "global scope". How do ppl manage the "database" on medium / big prolog programs? Can there be more than one database? Are there some sort of namespacing and/or modularity features? Sometimes the concept of relations is a bit mind-boggling because it seems difficult to distinguish between relations that act as "routines" or "procedures", or something alike, and terms that act more like pure data. It just feels like, if I was writing an imperative program in prolog style, it would be something akin to code interspersed with, say, embedded CSV data 😕 Hope this makes a bit of sense 🙂
Found this article that seem like a good reference, not sure yet. Any other hints / pointers / clarification and/or wisdom will be appreciated 🙂 https://chiselapp.com/user/ttmrichter/repository/gng/doc/trunk/output/tutorials/swiplmodtut.html
Copy code
Prolog is a very old language. It was first created before modular software development was the standing religion and it was not designed for this degree of modularity. Modules as a concept had to be retrofitted to a language design which almost, but not quite, actively resisted being made modular.
maybe that's why a lot of tutorials and books do not seem to cover the subject
j
One of the many reasons I prefer to embed logic programming into other languages rather than using PROLOG as such...
e
makes sense
d
Haven't read it myself, but maybe this is interesting to you: https://core.ac.uk/download/pdf/148662794.pdf (found the reference at https://ciao-lang.org/ciao/build/doc/ciao.html/modules.html )
w
Makes all the sense: the frustration. Great to see the topic come up at this moment.
tl;dr Both SWI and Ciao modules explicitly export public predicates plus some complexity surrounding the passing other predicates "meta predicates" to the module. And here I was expecting something more along the lines of Ocaml's Parameterized Modules (aka Functors) https://www.cs.cornell.edu/courses/cs3110/2012sp/lectures/lec09-functors/lec09.html.