Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.tc.cornell.edu!news.cac.psu.edu!news.math.psu.edu!chi-news.cic.net!nntp.coast.net!howland.reston.ans.net!swrinde!newsfeed.internetmci.com!btnet!news.compulink.co.uk!cix.compulink.co.uk!usenet
From: alanw@cix.compulink.co.uk ("Alan Westwood")
Subject: Re: a question regarding assertions from a neophyte
Message-ID: <DMqBn5.D9I@cix.compulink.co.uk>
Organization: Compulink Information eXchange
References: <1996Feb13.163043.24650@rosevax.rosemount.com>
Date: Tue, 13 Feb 1996 19:33:05 GMT
X-News-Software: Ameol
Lines: 29

In LPA prolog the behaviour is as follows:

If a predicate is undefined when it is called it generates an error.

If a predicate is asserted then that predicate becomes dynamic.

If the predicate is dynamic and is called and there are no clauses
the answer is "no" (fail)

If a dynamic predicate is abolished, it then becomes static and if then 
called it generates an error.

The programmer can change the behaviour of a program calling an
undefined predicate, so that the call fails rather than generates an
error. In general a developer would rather have an error generated,
so this is the default behaviour.

You can avoid generating errors on undefined dynamic code, by declaring
the predicates dynamic somewhere in your program before they are used,
or by setting a flag to indicate fail on the "undefined" error.

You can also set the flag to call a debugger...

regards,
Alan Westwood
alanw@cix.compulink.co.uk
Software Engineer
LPA Ltd.
 
