Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create procedure defect #2529

Open
flexoron opened this issue Sep 3, 2024 · 7 comments
Open

Create procedure defect #2529

flexoron opened this issue Sep 3, 2024 · 7 comments

Comments

@flexoron
Copy link

flexoron commented Sep 3, 2024

?- [user].
'P'.

   error(permission_error(create,static_procedure,nameless_procedure),load/1). % unexpected
?- 
@triska
Copy link
Contributor

triska commented Sep 4, 2024

Excellent catch!

Also:

?- assertz('A').
   error(type_error(callable,'A'),assertz/1), unexpected.
   true. % expected

@bakaq
Copy link
Contributor

bakaq commented Sep 4, 2024

Possibly related to #2496, but uppercase characters are much more common.

@UWN
Copy link

UWN commented Sep 4, 2024

'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

@bakaq
Copy link
Contributor

bakaq commented Sep 4, 2024

Seems to be an issue with parsing/compiling then.

@flexoron
Copy link
Author

flexoron commented Sep 4, 2024

$ 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).

@hurufu
Copy link
Contributor

hurufu commented Sep 4, 2024

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.

@UWN
Copy link

UWN commented Sep 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants