Open flexoron opened 2 months ago
Excellent catch!
Also:
?- assertz('A'). error(type_error(callable,'A'),assertz/1), unexpected. true. % expected
Possibly related to #2496, but uppercase characters are much more common.
'A'/0
can be asserted like so:
?- atom_chars(A,"A"), asserta(A).
A = 'A'.
?- 'A'.
true.
?- asserta('A').
error(type_error(callable,'A'),asserta/1), unexpected. % but not in this manner
Seems to be an issue with parsing/compiling then.
$ scryer-prolog -f
?- [user].
'A'('A').
?- 'A'(A).
A = 'A'.
?- atom_chars(A,"A"), 'A'(A), asserta(A).
A = 'A'.
%
% Addition: 'A'/0 can't be asserted like so:
%
?- 'A'(A), atom_chars(A,"A"), asserta(A).
error(type_error(callable,'A'),asserta/1).
I think it is related to string handling:
?- [user].
'P'.
error(permission_error(create,static_procedure,nameless_procedure),load/1).
?- 'P'.
error(existence_error(procedure,'P'/0),'P'/0).
?- [user].
'PP'.
?- 'PP'.
true.
?-
It happens only for single letter predicates.
It depends on the exact way how that name has been created
?- char_code(A,0'A),asserta(A).
error(type_error(callable,'A'),asserta/1), unexpected.
?- char_code(A,0'a),asserta(A).
error(type_error(callable,a),asserta/1), unexpected.
?- asserta('a').
error(type_error(callable,a),asserta/1), unexpected.
?- asserta(a).
true. % expected
Good news everyone: These cases work with the rebis-dev
development branch!