• Tyler MacDonald's avatar
    make `folly::Formatter` extendible · 664e121a
    Tyler MacDonald authored
    Summary:
    on advice of @tudorb, move most of `folly::Formatter` into `folly::BaseFormatter` so that we can use compile-time polymorphism to provide different types of Formatters.
    
    I wasn't able to get the recursive formatter to be polymorphic -- whenever I tried to convert `class FormatValue<Formatter<containerMode, Args...>, void>` into `class FormatValue<BaseFormatter...`, `FormatTest.cpp:Test(Format, Nested)` wouldn't compile because it couldn't find the template. @tudorb, if you have an easy fix for this, lmk, otherwise I'm (reluctantly) okay with requiring that `Formatter`s define their own nesting `FormatValue`.
    
    phew. the last time I did this sort of metaprogramming was over 5 years ago in perl. Doing it in C++ is... interesting.
    
    Test Plan: `fbconfig -r thrift folly cold_storage && fbmake dbg && fbmake runtests`
    
    Reviewed By: tudorb@fb.com
    
    Subscribers: tudorb, dgp
    
    FB internal diff: D1422343
    
    Tasks: 4624268
    664e121a
Format-inl.h 36.5 KB