[net.lang.prolog] Event handling in Prolog

rggoebel@water.UUCP (Randy Goebel LPAIG) (05/28/85)

Who has considered the problem of providing user predicates for the
handling of events (e.g., interrupt, various i/o and arithmetic exceptions)?

Waterloo Prolog (Roberts, 1977) had a built-in predicate ERROR which could be
used to provide one's own interrupt routine, e.g.,

	ERROR <-  ...user code ...

Has anyone considered the problem more deeply?  From a programming viewpoint?
From a logical viewpoint?

Randy Goebel
Logic Programming and Artificial Intelligence Group
Computer Science Department
University of Waterloo
Waterloo, Ontario, CANADA N2L 3G1
UUCP:	{decvax,ihnp4,allegra}!watmath!water!rggoebel
CSNET:	rggoebel%water@waterloo.csnet
ARPA:	rggoebel%water%waterloo.csnet@csnet-relay.arpa

vantreeck@logic.DEC (06/03/85)

      I'm not a theorist. From a programming point of view, the ease of
establishing event handlers depends on the hardware/OS support more than some
limitation of Prolog. Adding event handlers to Prolog implementations on
VAX/VMS should be a trivial task. Adding an Prolog predicate to generate an
exception, should also be easy. 

      Besides control-C, probably the best other example common of a Prolog
event handler, would be a garbage collection which occurs on the event of a
stack running into a protected page. Establishing a handler for integer or
floating point underflow over flow is easy - provided that the calculations are
done with routines that generate an exception. I don't know if implementations
like QUINTAS Prolog, which uses their own routines for their short floats,
generate exceptions on underflow/overflow. 

      If I were to write a concurrent Prolog, I think I would probably use an
event handler to manage the concurrency. I hope that the newer Prologs that
will be hitting the market in the next year or two of years will have predicates
for establishing and handling events. 

						George Van Treeck
						Digital Equip. Corp.