-
Notifications
You must be signed in to change notification settings - Fork 128
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
🧠 Logic: json_prolog
array serialization issue
#398
Comments
@bdeneux @ccamel I propose to respect to Prolog standard and not head towards SWI-PROLOG "unconventional" empty list consideration. We still need a solution though, amending the original specification. A As an example, the following Prolog:
What are your thoughts? Would represents: {
"empty": [],
"filled": [
"with",
"something"
],
"alsoFilled": [
0,
1
]
} |
@amimart Ok that seems a good solution we could use to allow empty list in json. Maybe to make more consistency we should rename the We have another solution, is to create a specific atom to represent an empty list, like null ( |
I have a deep feeling, whose origin eludes me, that the choice of using the functor |
@ccamel Yeah it seems simple, just add an |
🎉 This issue has been resolved in version 5.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Issue description
When unifying a json array through a Prolog empty list to its string representation, it outputs to the string
"[]"
instead of an empty json array:[]
.How to reproduce
This can easily reproduced with a
Ask
query using the CLI:We can observe the same results specifying the
'[]'
atom instead of an empty list:The reason under this behavior is related to the equality between an empty list and the
'[]'
atom at the interpreter level:First Analysis
An issue has been opened on the interpreter: ichiban/prolog#296.
It seems this behavior is expected, the SWI-PROLOG implementation having its specific empty list type being not standard.
Should the Prolog interpreter in the logic module be aligned on the standard or the SWI-PROLOG implementation? And then, how do we address the JSON array marshaling?
The text was updated successfully, but these errors were encountered: