Prev Next Up Home Keys Figs Search New

Smalltalk/Prolog Interface

Appeared in Volume 7/1, February 1994

Keywords: smalltalk, OOP.

newman@cujo.schbbs
Alan Newman
8th June 1993

D.S. Riches writes:
Has anyone managed to get Smalltalk applications and Prolog applications to talk to each other? Are there any interfaces to Prolog which are similar to the ones Smalltalk has for C++/C?

Smalltalk V used to have an implementation of Prolog in Smalltalk called Prolog V. I used it in 1988, and it wasn't very good. It was much more standard than Turbo Prolog, but still had many Smalltalk related exceptions and missing builtins. The Smalltalk/Prolog interface was pretty decent, but the overall system was very slow.

I ended up using Arity Prolog and interfacing it with Smalltalk V through the C interfaces of both languages. That worked well, although the interface requirements were pretty minimal. Smalltalk methods invoked Prolog with data passed through RAM disk files. Prolog emulated (somewhat poorly) the Smalltalk GUI while interfacing with the user.

spratt@hawk.cs.ukans.edu
Lindsey Spratt
9th June 1993

Another approach to running Smalltalk and Prolog on the Mac under System 7 is to use AppleEvents. LPA MacProlog 4.5 supports AppleEvents pretty extensively (based on reading the documentation, I haven't used this part of 4.5 yet). Thus (assuming there's a Mac Smalltalk which supports AppleEvents), you can have the Smalltalk application communicate with a MacProlog application via events.

podenski@bcsaic.boeing.com
Patrick Podenski
11th June 1993

There is an upcoming version of Digitalk Smalltalk/V Mac that will support AppleEvents. I believe that it is in beta right now, but I am not sure when it will be released.

trevor@bcarh4b7.bnr.ca
Trevor Blackwell
11th June 1993

What I'd really like to have is a non-deterministic programming kit in Smalltalk. I started to write one, but I sort of got bogged down in the complexities of Contexts.

Basically, it would provide a method you could call to create a choicepoint. This would save the current context stack. Execution would continue, but (probably through the stepping facility) all objects being changed would first have copies put in a dictionary, so they could be restored.

If code later calls an exception, then it will be intercepted at the choicepoint, all the touched objects reverted, and execution would be restarted. When calling the choicepoint method, it could return a different value each time (from a supplied list) in order to try the different solutions.

If you added some cut-like semantics, you could have a very nice little programming environment, with many of the benefits of Smalltalk and Prolog.

This doesn't seem terribly hard. I'm just not sure about the details of copying and restarting contexts.

Has somebody else done this?

Prev Next Up Home Keys Figs Search New