JanWielemaker / swi-erlang

Yes, Erlang in SWI-Prolog!
12 stars 1 forks source link

Monitoring of errors from the top-level is not correct. #1

Closed torbjornlager closed 6 years ago

torbjornlager commented 6 years ago

Due to the top-level behaviour of SWI-Prolog, the following is wrong:

?- spawn(test, _, [monitor(true)]).
ERROR: Undefined procedure: test/0 (DWIM could not correct goal)
?-

This is how it should work:

?- spawn(test, _, [monitor(true)]).
true.

?- flush.
% Got down(<engine>(9,0x7fd5cdf4a080),exception(error(existence_error(procedure,test/0),context(system:once/1,_1646))))
true.

(That's how it works if we do

?- call(spawn(test, _, [monitor(true)])).
true.

instead.)

JanWielemaker commented 6 years ago

That is simply how the toplevel behaves: it will try to correct and find all predicates referenced from the goal. You can avoid that using : rather than 0 as meta-predicate indicator. That might make sense if we include the whole thing including the source and remote nodes. If you just use the dispatch library the current declaration is correct.

torbjornlager commented 6 years ago

Ok, that makes sense.

On Mon, Nov 13, 2017 at 10:01 AM, Jan Wielemaker notifications@github.com wrote:

That is simply how the toplevel behaves: it will try to correct and find all predicates referenced from the goal. You can avoid that using : rather than 0 as meta-predicate indicator. That might make sense if we include the whole thing including the source and remote nodes. If you just use the dispatch library the current declaration is correct.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JanWielemaker/swi-erlang/issues/1#issuecomment-343854120, or mute the thread https://github.com/notifications/unsubscribe-auth/ACTC1K_YPY-tlq4hu-kF5oteNa_TUc6Nks5s2AVMgaJpZM4QbaYP .

-- Torbjörn Lager Professor of General and Computational Linguistics Department of Philosophy, Linguistics and Theory of Science University of Gothenburg Box 200, SE-405 30 Gothenburg, Sweden Phone: +46317864962