[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: 5.2 work3 manual
- From: Cuero Bugot <cbugot@...>
- Date: Wed, 19 May 2010 06:51:06 -0700
> Technically, I believe it is not. Whilst it has a definition, and it never
> returns a value that violates that definition, that it can return different
> values for two (as far as Lua can tell) identical tables means it's a
> "multivalued function", which is in the definition of "not well-defined" -
> at least according to wikipedia:
> http://en.wikipedia.org/wiki/Well-definition. ;)
Maybe not well-defined in a mathematical term, but still well-specified in a software term ;-). Think about the rand() function, it always returns a different value, still nobody argue about the fact that it is well specified ?!
Apart from the joke, I did use # on table with holes (on purpose), and love its well-specified behavior !
Indeed, I have an array of jobs that have unique ids. I start the unique ids at 1. I allow to reuse ids once the jobs have completed. Instead of maintaining a variable in order to compute the next available unique id that can be used, I simply use # on the table. All jobs are stored in 't[id] = job' manner. So I know that I'll have a free id with #t+1.
Cuero