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

Typo in ground/1 call? #48

Open
pmoura opened this issue Sep 4, 2019 · 2 comments
Open

Typo in ground/1 call? #48

pmoura opened this issue Sep 4, 2019 · 2 comments

Comments

@pmoura
Copy link

pmoura commented Sep 4, 2019

In the following clause:

map_output(ID, Term, json{event:output, id:ID, data:Data}) :-
( atomic(Term)
-> Data = Term
; is_dict(Term, json),
ground(json) % TBD: Check proper JSON object?
-> Data = Term
; term_string(Term, Data)
).

Do you meant to write instead ground(Term)?

@JanWielemaker
Copy link
Member

That is most likely what was intended. I think the remark also suggests that a ground test is
not ok though, so I think I'll leave it as is for now. Nice catch of dubious code though!

@pmoura
Copy link
Author

pmoura commented Sep 4, 2019

The Logtalk linter flags the ground(json) goal as a goal that's always true. This lint check can be fouled, however. It's also flagging elsewhere in the SWI-Prolog library the goal random(2) =:= 0 was always being false 🙃

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

2 participants