Calling imperative code from declarative?

I'm integrating imperative (OO) and declarative (Prolog-ish) languages. Accessing declarative constructs from imperative side is easy, as you can model them as an object model. The other direction is trickier. It is easy to represent OO data structures in predicate logic, but the concept of "calling" is difficult.

The standard approach, employed by numerous Prolog-embedded-in-Java tools, is to allow the user to give code to be run when given predicates are entered. It works, but is not very manageable. Are you aware of different solutions for this problem of turning declarative into imperative?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How To Declare An Imperative

How to declare an imperative is, as luck would have it, the title of a paper by Philip Wadler on using a monad to integrate interaction into a purely declarative language. The ideas there may not immediately translate into the Prolog world, but they might provide some pointers.