From jan@swi.psy.uva.nl Thu Feb  8 11:37:26 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f18AbQZ12989;
	Thu, 8 Feb 2001 11:37:26 +0100 (MET)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id LAA16146;
	Thu, 8 Feb 2001 11:37:25 +0100
Date: Thu, 8 Feb 2001 11:37:25 +0100
Message-Id: <200102081037.LAA16146@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: [SWIPL] I can not use system predicates after failure
To: johnw <johnw@mail.stu.edu.tw>
In-Reply-To: johnw's message of Thu, 08 Feb 2001 11:04:18 +0800
Phone: +31 - 20 - 525 6121
Cc: prolog@gollem.swi.psy.uva.nl

> Thanks for your reply.
> I read through my code and find the following interesting stuffs.
> 
> in file 'file001.pl':
> ------------------------------------------------
> set_swipl:-
> 	style_check(-discontiguous),
> 	style_check(-singleton),
> 	unknown(trace,fail).
> ------------------------------------------------
> 
>  in file file002.pl':
> ------------------------------------------------ 
>  :-['file001.pl'].
>  :-set_swipl.
>  -----------------------------------------------
>  
>  Now, let's use SWIProlog version 3.2.8 to load 'file002.pl' and invoke
>  gensym(a,P). It returns 
>  
>  --------------------
>  ?- gensym(a,P).
> 
> P = a1 
> 
> Yes
> ?- 
> ---------------------
> 
> Then, use version 3.4.1 (or later), we have 
> 
> ---------------------
> ?- gensym(a,P).
> 
> No
> ?- 
> --------------------
> 
> This could be one of my problems.
> Any idea?

Yes.  The difference is that gensym/2 used to be built-in and is now
a library predicate (from library(gensym)).  As you switch handling
unknown predicates to `fail', it will not try to do autoloading and
thus misses the definition of gensym/2.  Due to the same flag you
get a simple `No'.

You can fix this by loading gensym/2 by hand using

	:- use_module(library(gensym)).

Better, NEVER set handling unknown predicates to fail.  Declare 
predicates that might be called when they are not defined dynamic
or multifile.

	--- Jan

