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

Tables returning nil if no value



    One thing that bothers me is that table-entries that have never been
    defined return nil.  I often want to discriminate between values that
    have never been set and ones that have been set to nil.  Shouldn't
    uninitialized table-entries return some undefined value instead of nil?

The problem is that *any* value could be stored in the table, including
"some undefined value".

The correct solution is to return multiple values such as the following:

        (table-entry table key) => found?, value

where found? is true if there was a <key,value> pair in the table and
value is undefined if found? is false.

Any votes for this system?  Against?  

                                --- Jonathan