j2s: Unable to set default value of true on booleans #3
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Telodendria/Telodendria#3
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Because of the way the generated code works, we can't reliably default a boolean value to true, because both explicitly setting it and leaving it omitted in the JSON will cause the struct value to be false; we can't tell which occurred.
We could just set boolean fields to
-1
when they aren't specified. Then higher-level code can set the appropriate value from there, but buggy code may blindly check the boolean and see that-1
evaluates to true and thus behave in an unexpected manner.The other solution is to add support for setting default values at the parser level.
I think that would be the better solution here(removing non-generated initialization code for example).