Boost logo

Boost :

Subject: [boost] [hana] Review
From: edouard_at_[hidden]
Date: 2015-06-15 14:59:31


Dear all,

Please find attached my review of Hana.

> - Whether you believe the library should be accepted into Boost
>   * Conditions for acceptance

Definitely yes. I just have a very minor remark considering the documentation.

> - Your name

Edouard Alligand

> - Your knowledge of the problem domain.

I have been writing C++ professionally for 15 years and done a lot of TMP for many software project, for things such as compile-time introspection for serialization, enhanced checks at compile-time to improve correctness and compile-time pre-computations. I've done that with Boost.MPL, Boost.Fusion and some custom MPL.

> You are strongly encouraged to also provide additional information:
> - What is your evaluation of the library's:
>   * Design

I am very much impressed by the design of Hana and the cleverness of the usage of C++ 14 lambdas.

>   * Implementation

As far as I can judge it is very well implemented.

>   * Documentation

I think writing "using namespace boost::hana" for the documentation is confusion. I know it might be nit-picking, but I think the example is easier to understand when you read

struct Fish { std::string name; };
struct Cat { std::string name; };
struct Dog { std::string name; };
auto animals = boost::hana::make_tuple(Fish{"Nemo"}, Cat{"Garfield"}, Dog{"Snoopy"});

instead of

struct Fish { std::string name; };
struct Cat { std::string name; };
struct Dog { std::string name; };
auto animals = make_tuple(Fish{"Nemo"}, Cat{"Garfield"}, Dog{"Snoopy"});

Because if you read diagonally (and let's be realistic, we all read diagonally documentation) you might miss what is going on. At least some namespace alias would be helpful. I personally think redundancy is good in documentations.

>   * Tests

There is a satisfactory number of tests and the developer does continuous integration. The developer tests on several compiler versions at every change which is a must for a MPL.

>   * Usefulness

Boost.Hana is extremely useful, especially the compile-time introspection it adds. It uses macros but as long as the language doesn't provide features to do compile-time introspection, there is no way around this (that I can think of)

It has a lot of algorithms out of the box (at least I couldn't find one I would need that was missing). I like the compile-time arithmetic part of the library and find it very convenient.

I'm a big fan of Boost.Fusion and I use Boost.MPL a lot. Hana replaces both libraries and compiles faster at the cost of requiring recent compilers. It is, to me, a very acceptable tradeoff.

> - Did you attempt to use the library? If so:
>   * Which compiler(s)

Clang 3.5 on FreeBSD 10.1 and libc++

>   * What was the experience? Any problems?

The only problem I have with Hana is that it doesn't work with Visual Studio. The lack of VS is the only reason why we didn't adopt Hana on our product. Nevertheless, I don't think it a showstopper. Hana is an advanced MPL and the problem will solve by itself with time. It works, in my opinion, on a sufficient number on platforms at the moment to be accepted into Boost.

> - How much effort did you put into your evaluation of the review?

I ran by the examples again as I would if I were trying the library for the first time. I have been following Boost.Hana since Louis' presentation at last year cppcon in Bellevue, Wa.

Kind regards.

--Edouard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk