#221 read_canonical: # of vars limitation

wrong answer
open
nobody
None
5
2014-05-21
2014-05-21
No

I have a huge term, which can't be read using read_canonical because it says too many variables.
But the regular read does work. Is the limit on the number of vars different for read_canonical?
The term is attached.
You can check these two queries:

?- see(term), read_canonical(X), seen.
?- see(term), read(X), seen.

and see the difference.

Terry's explanation:
Note that read/1 is written in a mixture of Prolog and C, while read_canonical is written entirely in C. So read_canonical keeps variables in an array of length MAXVAR which is set to 1000 in context.h.

Of course, read_canonical should actually use a globally allocated array, and realloc whenever necessary. I've changed a number of tabling routines (which are also written in C) to do that over the years, but never made the change with read_canonical.

We should put this onto our bug list, but in the mean time, you should be able to get around this limit by setting the definition of MAXVAR to something higher than 1000 and recompiling XSB.

1 Attachments

Discussion


Log in to post a comment.