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

Re: Tables returning nil if no value

    The problem is that *any* value could be stored in the table, including
    "some undefined value".
The typical solution is to have a unique value defined in the table
interface, say *table-undefined*, which is used only for undefined
table entries.   There is no practical reason to store
*table-undefined* in a table as an explicit value.

The minor advantage of *table-undefined* compared with returning two
values is that it makes many applications simpler and slighlty more
efficient.   These applications will look up a key's value and compare
it for equality with some value they're holding; this test is a little
easier if *table-undefined* is used as sentinel value, since there will
be only one test instead of two.