From f2b63d1689c58be1c8b644d902d4e698aec653e6 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Fri, 5 Jan 2024 18:50:08 +0100 Subject: [PATCH] Prevent assertion of clauses for (-->)/2 when DCGs are enabled. This addresses #1508. --- src/lib/dcgs.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/dcgs.pl b/src/lib/dcgs.pl index 550009bb8..ef2e82533 100644 --- a/src/lib/dcgs.pl +++ b/src/lib/dcgs.pl @@ -14,7 +14,8 @@ phrase/3, seq//1, seqq//1, - ... //0 + ... //0, + (-->)/2 ]). :- use_module(library(error)). @@ -220,3 +221,10 @@ ). user:goal_expansion(phrase(GRBody, S), phrase(GRBody, S, [])). + + +% (-->)/2 behaves as if it didn't exist. We export (and define) it +% only so that clauses for (-->)/2 cannot be asserted when +% library(dcgs) is loaded. + +(_-->_) :- throw(error(existence_error(procedure,(-->)/2),(-->)/2)).