[patches] [PATCH 2/4] Move tuple_compare wrappers to key_def.h/.cc
Konstantin Osipov
kostja at tarantool.org
Tue Feb 20 00:12:33 MSK 2018
* Vladimir Davydov <vdavydov.dev at gmail.com> [18/02/18 23:27]:
> > The single-line wrappers don't work without key_def. By putting
> > them to key_def.h we reduce the number of necessary includes.
>
> IMHO it's semantically incorrect to put tuple manipulation functions to
> key_def.h, which is all about key_def helpers. If we ever have to extend
> tuple_compare() or tuple_extract_key() so that they are not one-line
> wrappers anymore, we'll have to move them back to tuple_compare.h and
> tuple_extract_key.h.
I merely think that the choice of a name should not play a
significant role: perhaps the name has been chosen incorrectly
after all, and the functions should be called
key_def_extract_key(), for example.
These functions require objects of two different types to produce
results, struct tuple and struct key_def.
There are three sets of files using these modules:
using tuple.h exclusively, using key_def.h exclusively, using both
types, tuple.h and key_def.h. In practice key_def.h already depends on tuple.h,
since key_def->compare requires tuple.h.
So my suggestion is to put the functions closer to the top of
the acyclic module dependency graph - in key_def.h and remove
(or work towards removing) a cyclic dependency between tuple.h and
key_def.h.
I hope this makes sense.
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov
More information about the Tarantool-patches
mailing list