[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_which
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 27 Oct 2014 20:54:39 +0200
2014-10-27 18:48 GMT+02:00 Hao Wu <wuhao.wise@gmail.com>:
>
>
> On Monday, October 27, 2014, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> But I can think of a perfectly genuine non-debugging application too.
>>
>> A database may be implemented as a table, where each time new
>> information is added, the old database is the __index of a new table
>> containing the items that have just been added/updated and some
>> fields identifying the update.
> Fair enough. If I understand correctly, in such an application, 'which' is
> equivalent to whether the value comes from the application cache or the
> actual data source. IMHO, you can have a different API, say,
> is_data_expired. I still feel the same way that asking which is equivalent
> to the object type in OO world, which has valid usage but disencouraged.
I'm not claiming that in this application, there is no other way
or even no better way. I'm just pointing out that, for the same
amount of work as retrieving the key, one could also retrieve
the actual table in which the value corresponding to that key
is present, and that this is a basic operation with some
interesting applications.