Steven Watanabe
AMDG
I've just glanced over the main page of the documentation and I had a few comments:
- _tuple
Historically names beginning with _ are used for placeholders. i.e. in Boost.Bind/Lambda/Phoenix/Parameter. Is there a good reason not to call it tuple?
It is because of other constructs in Hana like `tuple_t
- // BOOST_HANA_RUNTIME_CHECK is equivalent to assert In that case, what is the point of using it instead of assert? I think you should probably avoid using these constructs in the user documentation of other parts of the library. It's just a distraction, so it's better to rely on standard components, which users probably already understand.
The problem is that `assert` is not define when NDEBUG is defined, but I want my tests to fire up all the time. Since these examples are Doxygen'd out of actual source files, the macros end up in the documentation. Basically, If I could redefine `assert` to be `BOOST_HANA_RUNTIME_CHECK` in those test files, I'd be really happy. Would it be against good software craftsmanship to write ... include all you need ... #ifndef assert # define assert(...) BOOST_HANA_RUNTIME_CHECK(__VA_ARGS__) #endif
- Is there a reason for using length instead of size, which would be more idiomatic in C++?
Oversight caused by personal preference. I guess I should change that.
- Amphibian algorithms!!!??? Okay, I guess the name is kind of clever. I can't say that I really like it, though.
If you have anything better to propose, I'm all ears.
- foldl/foldr. I really hate these names. I'd prefer fold/reverse_fold, but even fold_left/fold_right would be better.
I personnally hate reverse_fold, since I don't see how it is a "reverse" fold. It's just a fold with different _associativity_ properties. As for fold_right and fold_left, I guess it comes down to personal preference. I opened a "poll" on GitHub to settle this. See [1].
- count is the equivalent of std::count_if, not std::count. - find/lookup should be find_if/find
You're right. It's sometimes hard to set aside personal preferences for the greater good, but I'll do it :-).
- In general I would expect any algorithm that takes a single element for comparison to have both f and f_if forms.
It is possible that a structure can do lookup by equality but not by any predicate, so it wouldn't be able to provide both. But do you have an example in mind of a place where there's an *_if variant missing in Hana? It would almost surely be an oversight.
- sort(predicate): shouldn't this be sort(sequence)?
Typo; thanks for reporting. Louis [1]: https://github.com/ldionne/hana/issues/18