Re: SWI-Prolog : current_prolog_flag(unknown, fail) is failing.



Jan Wielemaker wrote:

It helps a lot if you say what you are doing in the first place.

1 ?- set_prolog_flag(unknown, fail).

Yes
2 ?- call(foobar).

No.

Note:

?- foobar.
ERROR: Undefined procedure: foobar/0

This is the DWIM (Do What I Mean) correction system of the toplevel that
still complains. Whats the point calling something from the toplevel that
doesn't exist?

--- Jan

P.s. Don't change this flag. Its a bit nuisance and it should never
have existed in the first place. In SWI-Prolog in particular as
most of the environment relies on autoloading and you cannot do
that if calling an undefined is not an error. See the dynamic
directive.

If you really have to, for example to test a possible incomplete
program as a logical theory, change the flag in the context of
a module and load the theory into that module.

Jan,

My fault. Jumping between SWI-Prolog and another Prolog and I got
confused between the "prolog_flag" predicates which are slightly
different between the versions. I should have been using
"set_prolog_flag".

Re: Don't use it.

Would there be any harm in setting the "unknown" flag to "fail" and
back to "error" before and after the top level goal? I could wrap the
top level goal that way.

Thanks.

.