[Galago-devel] Libsoylent API

Colin Barrett timber at lava.net
Mon Jun 20 04:20:40 EEST 2005


On 6/19/05, Travis Reitter <treitter-dev at netdrain.com> wrote:
> Here's my current line of thinking for the Libsoylent API.
>=20
> We have a major choice between restricting the calling programs' access
> to accessor ("get" someone's metadata) and mutator ("set"), constructor
> (create a new person), and deconstructor [?] (delete a person)
> functions, giving the caller an ID for each person; or actually
> returning a SoylentPerson struct and letting the caller modify and
> access people metadata there.
>=20
> The first approach is more restrictive and would be slower (though it
> probably wouldn't be significant), but would cleanly abstract some
> details from the caller (for instance, a set function would directly
> make evolution-data-server modify the existing database). The second
> approach would require some synchronization (after modifying a
> SoylentPerson struct, the caller would need to use a function to save
> the changes to the database(s)).

If the library is in C, then the C API is probably best to be
get/set-based. Any language bindings that have proper support for
objects could then implement object-y API with those (which can detect
errors on set/get or something like that).

It would sound a little too error prone to let the user modify a
struct directly in C, and would result in a messy error detection
code.

--=20
Kalle Vahlman, zuh at iki.fi



More information about the galago-devel mailing list