All the reference fixtures in JSON format show some properties as having null values. Lua of course handles nil a bit differently than some languages. For the purposes of comparing fixtures when I load the JSON into a Lua table everything works out fine because the nulls load as nils and the comparison works okay. However trying to get JSON output that matches is a bit more difficult. For external comparison I'm currently stripping the null's usig jq:
walk( if type == "object" then with_entries(select(.value != null)) else . end)
...but that's a hack.
Should we be using a custom null value in our AST internally so we can match what other implementations have? Or is Lua's nil handling going to suffice?
All the reference fixtures in JSON format show some properties as having
null
values. Lua of course handlesnil
a bit differently than some languages. For the purposes of comparing fixtures when I load the JSON into a Lua table everything works out fine because thenull
s load asnil
s and the comparison works okay. However trying to get JSON output that matches is a bit more difficult. For external comparison I'm currently stripping the null's usigjq
:...but that's a hack.
Should we be using a custom
null
value in our AST internally so we can match what other implementations have? Or is Lua'snil
handling going to suffice?