« Return to Thread: Patch for GPL/error.pl - fixes is_of_type/2 bug

Patch for GPL/error.pl - fixes is_of_type/2 bug

by Brian DeVries :: Rate this Message:

Reply to Author | View in Thread

In GPL/error.pl, is_of_type/2 calls has_type/2, which calls is_list/1 for list types. However, when importing module library(lists), is_list/1 is not imported, causing the predicate to fail (at least from my runs):

Before patch:

% yap
% Restoring file /usr/local/lib/Yap/startup
YAP version Yap-5.1.4
   ?- yap_flag(unknown, error).
yes
   ?- use_module(library(error)).
 % reconsulting /usr/local/share/Yap/error.pl...
  % reconsulting /usr/local/share/Yap/lists.yap...
  % reconsulted /usr/local/share/Yap/lists.yap in module lists, 4 msec 34256 bytes
 % reconsulted /usr/local/share/Yap/error.pl in module error, 8 msec 66768 bytes
yes
   ?- is_of_type(list, []).
     ERROR!!
     EXISTENCE ERROR- procedure is_list/1 is undefined, called from context  prolog:$do_yes_no/2
                 Goal was error:is_list([])


After patch:

% yap
% Restoring file /usr/local/lib/Yap/startup
YAP version Yap-5.1.4
   ?- yap_flag(unknown, error).
yes
   ?- use_module(library(error)).
 % reconsulting /usr/local/share/Yap/error.pl...
  % reconsulting /usr/local/share/Yap/lists.yap...
  % reconsulted /usr/local/share/Yap/lists.yap in module lists, 4 msec 34240 bytes
 % reconsulted /usr/local/share/Yap/error.pl in module error, 4 msec 67552 bytes
yes
   ?- is_of_type(list, []).
yes


I've included (both inlined and in an attachment) a small patch against commit 28474bb to fix this.

As a side question: is the patch file directly applicable against the git repository? Is there additional information I should include to make the process easier on y'all?

Hope this helps!

Thanks,
~Brian W. DeVries

diffstat:

% git diff --stat master  
 GPL/error.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


patch:

% git diff master                      
diff --git a/GPL/error.pl b/GPL/error.pl
index db55e43..4e806d2 100644
--- a/GPL/error.pl
+++ b/GPL/error.pl
@@ -43,7 +43,7 @@
 
 :- if(current_prolog_flag(dialect, yap)).
 
-:- use_module(library(lists),[memberchk/2]).
+:- use_module(library(lists),[memberchk/2, is_list/1]).
 
 :- endif.

[error_is_list.patch]

diff --git a/GPL/error.pl b/GPL/error.pl
index db55e43..4e806d2 100644
--- a/GPL/error.pl
+++ b/GPL/error.pl
@@ -43,7 +43,7 @@
 
 :- if(current_prolog_flag(dialect, yap)).
 
-:- use_module(library(lists),[memberchk/2]).
+:- use_module(library(lists),[memberchk/2, is_list/1]).
 
 :- endif.
 


------------------------------------------------------------------------------

_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

 « Return to Thread: Patch for GPL/error.pl - fixes is_of_type/2 bug