[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 09:35:47 +0200
2014-10-27 8:38 GMT+02:00 Hao Wu <wuhao.wise@gmail.com>:
> Curious why/when you need such a function? Would the retrieval become
> dependent on how the accessor is implemented, which would lead to that
> the client code will rely on implementation details of API provider?
It's mainly for debugging, but you can't have anything in the debug library
(in fact, in any standard library) if it is not in the API.
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.
When you retrieve an item, you would like to know its provenance.
The "which" function directs you immediately to the source, or
maybe to "SECRET".
It does not rely on implementation details, only on the chronological
ordering of updates.