Assumed predicates will override similarly named asserted predicates which however will NOT override compiled ones anymore. This change was required to simplify the implementation of BinProlog 5.75's new dynamic recompilation scheme. Both in interpreted and the compiled execution, starting from version 5.75, the engine will try compiled versions of a predicate FIRST. Note that overriding is done at predicate, not clause level. Note also that multifile compiled clauses are still forbidden in standalone executables, while allowed in code compiled to memory. Multifile assumed and dynamic code is now accepted. BinProlog 5.75 allows overriding of compiled predicates. The new builtin
override(OldPred,NewPred)backtrackably overwrites the header of the compiled definition of OldPred with a jump instruction to the definition of compiled predicate NewPred. The builtin also works with C-ified code.
Partial evaluation of some frequently used idioms conflicts with overriding. For instance you should do
vset(peval_io,int(0))to switch this optimization off before compiling if you want to override components of BinProlog's I/O subsystem.
Explicit overriding for purpose of switching between static and dynamic versions of the same code should be avoided as it is error prone and it is taken care of by the automatic dynamic recompilation module of BinProlog.
It is expected that in the next version overriding will be encapsulated through the use of an object oriented scheme, and the specification of override/2 might change.