lua-users home
lua-l archive

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


Thanks for all the suggestions, but again I think you are missing the point. It's not HOW to work around the issue for an application, it's if it's GOOD or BAD that I SHOULD have to work around it. I can think of (easily) a dozen ways to handle this. But I stand by my point; it's an oddity of the language that I cannot use nil to mark an array entry as empty, and my suggestion was to fix that in a clean simple manner. Nothing more, nothing less.

As for the "Lua is clean and tight, don't extend it" .. yes I agree, one of the best aspects of the language is the tight, clean, elegant design. But if EVERY suggestion is met with "we can't add that because Lua is small" then NOTHING will ever change and Lua is complete NOW. Which is clearly not the case.

No-one has answered my original question: How can I write a CLEAN C library that emits a SQL rowset that might include NULL values? Without "empty", I cannot see a clean way to do this. And, to be honest, I don't accept the "everything is a workaround" argument, since if thats the case _javascript_ or APL or FORTRAN for that matter (shudder) are all as good as Lua.

--Tim


On Jun 28, 2013, at 1:36 AM, Michal Kottman <michal.kottman@gmail.com> wrote:

On 28 June 2013 10:03, Michal Kolodziejczyk <miko@wp.pl> wrote:
type=function(o)
  if getmetatable(o)==_EMPTYMT then
    return 'empty'
  else
    return type(o)
  end
end

This of course would have to be:

 do
  local oldtype=type
  type=function(o)
    if getmetatable(o)==_EMPTYMT then
      return 'empty'
    else
      return oldtype(o)
    end
  end
end

Otherwise you end up in an infinite tail-call loop :)