fluent-lua icon indicating copy to clipboard operation
fluent-lua copied to clipboard

Much ado about nothing, aka `nil`

Open alerque opened this issue 6 years ago • 0 comments

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?

alerque avatar Sep 22 '19 06:09 alerque