Retractall vs. abolish

Hello,

Just noticed a key difference between retractall and abolish.

Abolish not only removes dynamic predicates but also “forgets” the dynamic/1 declaration.

Interestingly, since swi-prolog doesn’t cause an error when asserting a dynamic predicate without a prior dynamic/1 declaration, everything looks good – but, if one tries to call a dynamic predicate before a first is asserted, then this fails (miserably).

The remedy is to pair an abolish with a dynamic call.

However, retractall/1 does not “forget” the prior dynamic declaration and everything is fine …

Dan

3 Likes