3 ms·
>> This inconsistency and problem is hard to replicate and very, very hard to debug. My experience is the opposite. Because Prolog is an interpreted langauge,
by YeGoblynQueenne 8y ago
>> This inconsistency and problem is hard to replicate and very, very hard to
debug.
My experience is the opposite. Because Prolog is an interpreted langauge, and
because it tends to not need the global dependencies other languages have
(e.g. no variables declared outside a predicate's closure etc) it's very easy
and convenient to program in a "bottom-up" approach.
Which means, in plain English, that everytime you add a new predicate to your
program, you can test it immediately on the command line and see whether it
"goes infinite" or behaves in other ways strangely. It's kind of like test-
driven programming; let's say, REPL-driven programming.
And let's not forget that you can get in an infinite-loop situation with any
language. I have fond memories of working at a C# shop, where one line of code
in a shared lib brought down the entire stack of web apps deployed by the
company, because someone hadn't tested a terminating condition in an iterative
loop. The post-mortem went a bit strange and it seems (I wasn't present) that
upper management, who didn't know much about programming, advised that
iterative constructs like for-loops etc should be henceforth avoided like the
plague and recursion used instead. Obviously, nobody even tried to do that.
In another incident, in the same shop, one of the designers caused the
in-house, jango-like, templating language, to go into an infinite recursion.
Apparently, the jango-like language (called "mango") was Turing complete.
Whaddaya know.
Playing with Turing machines is dangerous. They tend to get tied up in loops.
You should know that, understand why, and code as to avoid it in any
language, not just Prolog.
- pjmlp 8y agoMost relevant Prolog implementations use a Warren machine like implementation with JIT.
- aeneasmackenzie 8y agoThey still have REPLs, which is the relevant part.
- pjmlp 8y agoHaving a REPL doesn't mean the implementation is using an interpreter. Many languages do have REPLs which JIT before execution.
- YeGoblynQueenne 8y agoFine, 'scuse my imprecision: it's JIT interpreted. The point is that you can do bottom-up programming at the command line (a.k.a. the "listener" in Prolog).
- sgt101 8y agoYup - if you have control over your code base and can keep it totally consistent you have a fighting chance, but as I say - some shifty person introduces a problem and all goes very very wrong. The big demonstration is that it's really rarely used in industry. Which is a big shame as if we could sort out the programming in the large then I believe big value is on the table. The new generation of reasoners are a good start!
- zephyrfalcon 8y agoIf "some shifty person introduces a problem", then that's bad news for any code base in any language. Nothing specific to Prolog. > The big demonstration is that it's really rarely used in industry. By that reasoning, software written in Javascript must be extremely reliable and easy to debug. >.>
- posterboy 8y agoThat's an unfair metric because prolog was never meant to develope web apps or whatever the majority of use cases is. It's not used in AI either, but I'm glad to hear for the first time that it's being worked on so chances are there could be more I haven't heard of. And there are similar, reduced systems like kanren. I don't know how coq, lean or other theorem provers compare, but the space is hugely interesting.