You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Marvin Humphrey <ma...@rectangular.com> on 2009/08/19 15:37:28 UTC
Keyword "inert"
Keyword "inert"
Greets,
The keyword "inert" has been present in some of the Boilerplater code that's
gone by in recent commits. It means "the opposite of dynamic".
* An "inert" class is not instantiable.
* An "inert" subroutine is an independent function provided by a class,
rather than an object method.
* An "inert" variable is a shared global as opposed to a member variable.
In Java, "static" is the keyword that means "the opposite of dynamic", and
that is what I had originally used in Boilerplater. However, "static" has a
different meaning in C, which yielded some confusing inconsistencies:
* "static" functions declared in a .bp file were in fact being
declared as ordinary C functions -- which are implicitly "extern" when
declared in a header as opposed to "static".
* Similarly, "static" variables were actually being declared as "extern" in
the autogenerated C header as well.
* Implicitly "dynamic" Boilerplater methods have small autogenerated "static
inline" invocation wrappers.
To resolve the conflict, "inert" has been substituted. Here's a sample:
/** Utilities for parsing, interpreting and generating index file names.
*/
inert class Lucy::Util::IndexFileNames cnick IxFileNames {
/** Skip past the first instance of an underscore in the CharBuf, then
* attempt to decode a base 36 number. For example, "snapshot_5.json"
* yields 5, and "seg_a1" yields 27.
*
* @return a generation number, or 0 if no number can be extracted.
*/
inert i32_t
extract_gen(const CharBuf *name);
/** qsort-friendly routine for comparing CharBufs according to
* extract_gen().
*/
inert int
compare_gen(const void *va, const void *vb);
/** Return the name of the latest generation snapshot file in the Folder,
* or NULL if no such file exists.
*/
inert incremented CharBuf*
latest_snapshot(Folder *folder);
}
Marvin Humphrey