Special meaning of table

With v9.0.4:

?- T = table, atom(T).
ERROR: Syntax error: Operand expected, unquoted comma or bar found
ERROR: T = tabl
ERROR: ** here **
ERROR: e, atom(T) . 

Is this a bug or intentional?
And if it is not a bug, why is this so?
At least I didn’t find anything about it in the manual.

table is a high-priority operator used for e.g.,

 :- table p/1, q/2.

According to the standard, this should not parse. It doesn’t in SWI-Prolog. It does in SICStus, which performs more elaborative search to find legal interpretations by dropping the operator property of some atoms. Given the infix operators = and ,, the only way out is to pretend table is not an operator. SWI-Prolog does similar reasoning, but more limited, e.g.,

?- T = table.

works as expected while this too fails in e.g. GNU-Prolog if we define table using ?- op(1150, fx, table).

Anyway, the way out is to write it as below.

?- T = (table), atom(T).

If you have a lot of table and no intend to use tabling, you can also use this to kill the operator property for table.

?- op(0, fx, table).
1 Like

Thanks for the explanation!
I stumbled across it when porting an application from an older version of SWI-Prolog, but of course it’s not a show stopper.