lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2. It's a pity there were not more posts along the lines of:
   - This is what we do in our organization.

Well, I cannot speak for a 'community of best practice' but this is how I see the problem. Lua does not have null, as understood in other languages. The concept is embedded in many external data formats and is distinct from a false boolean value.  So a JSON module will define json.null and a DB module will define db.null.  If I wanted to dump out a database record to JSON then I must do something like this:

tsub(rec,db.null,json.null)   -- really easy and general function to write

If Lua 5.3 introduced 'null' (however implemented - tho it would be nice if it evaluated as 'false') then we would have the usual lag where everyone had to port their modules, and in a few years everyone would use null.  In the meantime, compatibility libraries would appear.
So why not agree to use some standard definition of null, embedded in a little library and skip the core change?

Even so, the above transformation is hardly a difficult one, it's just one of those things one has to explicitly check.

The array-hole issue is a red herring here - it's part of another conversation. It's possible to write user-defined array types which have the strict properties required of 'classical' arrays.

steve d.