You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How should Projog behave when a file defines a predicate that has already been defined by another file? This question was raised as an outcome of #195. Please see that issue for further information. The consult/1 predicate is used to read predicates from a file.
Current approach:
The current behavior of Projog is demonstrated in #195. If a predicate's clauses are defined across multiple files then the predicate must be defined as "dynamic". By default predicates are considered "static". The user must use the dynamic/1 to make it explicit that the predicate is dynamic.
instead of specifying explicitly the dynamic aspect of a predicate, that is bit code intrusive and UX disadvantaging, to keep by default, as it the case today, predicates static and once updated, move them to dynamic, in total transparent way
Created this issue to review the current behavior and consider alternatives.
Possible approaches to dealing with a predicate being defined by multiple files:
The new clauses could be added to the old clauses. This was the approach suggested in #.
The new clauses could replace the old clauses.
Projog could report an error and ignore the new clauses.
Things to consider:
What would be most convenient for users of Projog?
What is the most common approach implemented by other Prologs? From a quick search it appears that some Prologs support a multifile/1 predicate to indicate that a predicate may be defined over more than one file. Using multifile/1 has the same disadvantage as dynamic/1 in that it requires the user to specify that a predicate will be split across files, rather than Prolog dealing with it automatically. TODO: do some more investigation into how other Prologs behave.
How easy would these approaches be to implement in Projog? Projog would need to undo any optimisations of a predicate if subsequent alterations meant they were no longer appropriate.
How should Projog behave when a file defines a predicate that has already been defined by another file? This question was raised as an outcome of #195. Please see that issue for further information. The
consult/1
predicate is used to read predicates from a file.Current approach:
The current behavior of Projog is demonstrated in #195. If a predicate's clauses are defined across multiple files then the predicate must be defined as "dynamic". By default predicates are considered "static". The user must use the
dynamic/1
to make it explicit that the predicate is dynamic.A suggestion made in #195 was:
Created this issue to review the current behavior and consider alternatives.
Possible approaches to dealing with a predicate being defined by multiple files:
Things to consider:
multifile/1
predicate to indicate that a predicate may be defined over more than one file. Usingmultifile/1
has the same disadvantage asdynamic/1
in that it requires the user to specify that a predicate will be split across files, rather than Prolog dealing with it automatically. TODO: do some more investigation into how other Prologs behave.Further reading:
https://www.swi-prolog.org/pldoc/man?section=consulting
https://www.swi-prolog.org/pldoc/man?predicate=multifile/1
http://www.gprolog.org/manual/html_node/gprolog022.html#sec53
https://sicstus.sics.se/sicstus/docs/4.2.1/html/sicstus/Multifile-Declarations.html
The text was updated successfully, but these errors were encountered: