lua-users home
lua-l archive

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


>      Using # on tables with holes is what every other language manual
> would describe as undefined behaviour.

Unfortunately, I think many other language manuals are not good examples
to follow.

In C ---which is a good example--- "undefined behaviour" really means
undefined behavior (e.g., "ignoring the situation completely with
unpredictable results"). Maybe you mean "unspecified behavior"?

But I think this is more related to expectations. As Cuero pointed out,
nobody considers that "random" has an unspecified behavior, even though
it can return anything. As another example, if you get the documentation
for Posix threads, there are very few garanties about anything. (Last
time I read even a single-threaded implementation could satisfy the
specifications.)

I think the main point is whether the result is useful or not. Most
people (not without reason) consider the result of #t on a table with
holes as useless (but Alexander found it useful ;).

-- Roberto