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

View: New views
2 Messages — Rating Filter:   Alert me  

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

by Brian DeVries :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Vitor Santos Costa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Brian

Sorry for the delay in answering.

I included your patch in the stable version.

Regarding the devel version, I decided to move is_list to be a
built-in, like for SWI. This should improve compatibility between the
two systems and avoid this kind of problem (the error.pl is from SWI
file). It is also faster, because I rewrote it in C.

Thanks!

Vitor

On Sun, Apr 5, 2009 at 10:47 PM, Brian DeVries
<contingencyplan@...> wrote:

> 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.
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Yap-users mailing list
> Yap-users@...
> https://lists.sourceforge.net/lists/listinfo/yap-users
>
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users