alerque / fluent-lua

Lua implementation of Project Fluent https://projectfluent.org
MIT License
20 stars 4 forks source link

Much ado about nothing, aka `nil` #7

Open alerque opened 5 years ago

alerque commented 5 years ago

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?