Jan Burse schrieb:
> Maybe the code quality of discontiguous predicates
> is therefore even not that good.
It depends whether the fixup can also fix incomplete
indexes. Or whether the last try is kind of a
catch all, so that with each block of clauses a
new sub index starts.
Having a couple of sub indexes, on type or newer
WAM code on functor, might slow down your code,
since re-indexing the same argument multiple times,
can be slower I guess.
But this is all guesswork. Probably papers and
inspecting the WAM code that GNU Prolog generates,
or even going down an looking at the assembler code,
would be more serious work here. Not really that
time at my hands.
Bye
P.S.: The multi-file directive has also an interesting
history. It wasn't that sophisticated in the beginning
I guess, and simply only prevented abolishing the given
predicate during reconsult. But it needed also to do the
last try WAM code thing, because well as the directive
says, another file can also have the predicate.
But nowadays one expects that a prolog system keeps
track for each clause from which source file it comes,
so that a reconsult can only expell exactly these clauses.
What must be tested for GNU Prolog is whether multi-file
implies discontiguous, which would be bad news.
But I guess modern Prolog systems don't mix multi-file
and discontiguous anymore. Or lets say, they shouldn't
mix multi-file and discontiguous. Sadly some Prolog
systems still do. Here is an example from SWI-Prolog:
Without multifile:
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.1.23)
Copyright (c) 1990-2014 University of Amsterdam, VU Amsterdam
?- [user].
a.
b.
a.
Warning: user://1:11:
Clauses of a/0 are not together in the source-file
With multifile:
?- [user].
:- multifile p/0.
p.
q.
p.
Compare this to Jekejeke Prolog:
Without multifile:
Jekejeke Prolog, Development Environment 1.0.4
(c) 1985-2014, XLOG Technologies GmbH, Switzerland
?- [user].
a.
b.
a.
Warning: Discontiguous predicate a/0, declare accordingly.
With multifile:
?- [user].
:- multifile p/0.
p.
q.
p.
Warning: Discontiguous predicate p/0, declare accordingly.