[RFC/PATCH 0/5] macro-based key/value maps
- From
Jeff King <peff@peff.net>
- Date
- Aug 4, 2011, 22:43 UTC
- Message-ID
- <20110804224354.GA27476@sigill.intra.peff.net>
- In-Reply-To
- <7vipr4373f.fsf@alter.siamese.dyndns.org>
On Thu, Jul 14, 2011 at 02:06:28PM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes: > > > Doing macro meta-programming like this makes me feel a little dirty, but > > I actually think the result is more readable. > > > > [1/3]: implement generic key/value map > > [2/3]: fast-export: use object to uint32 map instead of "decorate" > > [3/3]: decorate: use "map" for the underlying implementation > > > > What do you think? > > Yeah, dirty but nice ;-)
Well, if you like that, then here is the end-result of what the persistent version would look like. It's quite convenient to use, but an awful pain to debug. It's done entirely in the preprocessor; I suspect if I wrote the code generation externally, that would be easier and more readable (and there are one or two places where we could be slightly more efficient, that are just difficult to implement via the preprocessor).
[1/5]: implement generic key/value map [2/5]: fast-export: use object to uint32 map instead of "decorate" [3/5]: decorate: use "map" for the underlying implementation [4/5]: map: implement persistent maps [5/5]: implement metadata cache subsystem
-Peff