

Thoughts on Rule-Based Programming - lazugod
http://www.eblong.com/zarf/essays/rule-based-if/

======
snorkel
The backward subject-verb semantics in the OO examples are typical anti-OOP
straw men. It doesn't have to be Room.look() and Object.examine(), when it
could simply be Player.look(Room), Player.examine(Object), Player.put(Meat,
Basket), etc. Don't begin with a design pattern then write code around that
poorly choosen pattern. Instead write your core logic expressions first then
it becomes obvious what the structure of each object ought to be.

------
james2vegas
Prolog isn't all that weird and a pretty good language for adventure ages,
see:
[http://www.csc.villanova.edu/~dmatusze/resources/prolog/slee...](http://www.csc.villanova.edu/~dmatusze/resources/prolog/sleepy.html)
[http://www.csc.villanova.edu/~dmatusze/resources/prolog/spid...](http://www.csc.villanova.edu/~dmatusze/resources/prolog/spider.html)

~~~
ramses0
Speaking of Prolog, I often run into situations where I would love to have
some semi-dialect of prolog available at runtime (ie: use regexes for simple
string problems, use prologexes for simple logic problems).

Are you aware of any prolog-like languages that integrate well with other
programming languages?

~~~
silentbicycle
I don't know of any (outside of semi-toy Prologs in _On Lisp_ and PAIP), but
writing a Prolog dialect designed for embedding (in a similar manner to Lua)
is near the top of my list of future projects. Prolog can be really awkward
for some things (most notably IO / side effects), but for certain problems,
its approach is an excellent fit.

Constraint programming (often bundled with Prolog) also deserve far more
attention, IMHO.

~~~
copper
For CP, GECODE is C++, which makes it very easy to bundle /if/ you're writing
in that language.

SWI-Prolog can be used embedded - but I haven't any experience with the
results.

~~~
silentbicycle
I'm reading Guido Tack's thesis now, actually, trying to get a better sense of
how constraint systems are implemented.

SWI is my usual Prolog runtime, but I haven't tried running it embedded. I
really like Lua's design principle of, "The language doesn't handle this
particular thing well, but since it's embedded, it _doesn't need to_ \- keep
the language small". A mini-Prolog could focus on what it does best, have a
simple C API, and leave the rest to the surrounding language.

------
lylejohnson
Thanks so much for posting this, it brings back fond memories of playing IF
games as a kid (wish I still had that much free time on my hands). Saved to
InstaPaper for later reading.

------
Mathnerd314
This sounds exactly like the semi-secret language that's been floating around
in my head for months!

